Prerequisites: Authentication · Run a card sale
A service fee is an additional amount that you add to a sale to help cover administration costs. Only certain cards and industries are eligible for service fees.
How we calculate the service fee depends on the card type:
- Credit cards: The service fee can be only a percentage of the sale amount.
- Debit and prepaid cards: The service fee can be a percentage of the sale amount or a flat amount.
To add a service fee to a sale, calculate the amount of the service fee, disclose it to the customer, and then run the sale. If the customer doesn't accept the service fee, let them cancel the sale.
Integration steps
Step 1. Look up BIN information. Step 2. Run a sale.
Before you begin
Make sure that your processing terminal is set up for service fees. If you want to add a service fee to sales, contact our Integrations team at payroc-integrations@payroc.com.
Authenticate your requests before making API calls. If your request fails, see Errors.
Step 1. Look up BIN information
To check if a card is eligible for a service fee and to calculate the fee amount, send a POST request to our Cards endpoint.
| Environment | URL |
|---|---|
| Test | https://api.uat.payroc.com/v1/cards/bin-lookup |
| Production | https://api.payroc.com/v1/cards/bin-lookup |
Request parameters
Include the total amount of the sale in the amount parameter. Our gateway uses the amount to calculate the service fee.
To create the body of your request, use the following parameters:
Schema (request.body)
Request body schema for POST /cards/bin-lookup
Example request
POST https://api.payroc.com/v1/cards/bin-lookup
{
"processingTerminalId": "1234001",
"amount": 4999,
"currency": "USD",
"card": {
"type": "card",
"cardDetails": {
"entryMethod": "keyed",
"keyedData": {
"dataFormat": "plainText",
"cardNumber": "4539858876047062",
"expiryDate": "1230"
}
}
}
}
Response fields
If your request is successful, our gateway returns a serviceFee object in the response, which contains information about the service fee, and a disclosure statement that describes the fee.
Show the customer the new total with the service fee, and the disclosure statement from the response. If the customer accepts the new total, go to Step 2. Run a sale.
Schema (response.body)
Response body schema for POST /cards/bin-lookup
Example response
{
"type": "Visa",
"cardNumber": "453985******7062",
"country": "US",
"currency": "USD",
"debit": false,
"serviceFee": {
"applicable": true,
"amount": 150,
"percentage": 3.0,
"basis": "creditPercentage",
"disclosure": "A 3% service fee applies to this payment."
}
}
Step 2. Run a sale
If the customer accepts the service fee, run the sale. You don't need to change your request to add the service fee. Send the sale amount as normal, and our gateway automatically applies the service fee.
To run a sale, send a POST request to our Payments endpoint.
| Environment | URL |
|---|---|
| Test | https://api.uat.payroc.com/v1/payments |
| Production | https://api.payroc.com/v1/payments |
Request parameters
To create the body of your request, use the following parameters:
Schema (request.body)
Request body schema for POST /payments
Response fields
If your request is successful, our gateway runs the sale and adds the service fee to the transaction total. The response includes a serviceFee object in the payment breakdown:
Schema (response.body)
Response body schema for POST /payments
Example response
{
"paymentId": "M2MJOG6O2Y",
"status": "approved",
"order": {
"amount": 5149,
"currency": "USD",
"breakdown": {
"subtotal": 4999,
"serviceFee": {
"amount": 150,
"percentage": 3.0,
"basis": "creditPercentage"
}
}
}
}