Skip to content
developers

Add a service fee to a sale

Add a service fee to a card sale by looking up BIN information to calculate the fee, disclosing it to the customer, then sending a POST request to the Payments endpoint.

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

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.

EnvironmentURL
Testhttps://api.uat.payroc.com/v1/cards/bin-lookup
Productionhttps://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

JSON
{
  "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

JSON
{
  "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.

EnvironmentURL
Testhttps://api.uat.payroc.com/v1/payments
Productionhttps://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

JSON
{
  "paymentId": "M2MJOG6O2Y",
  "status": "approved",
  "order": {
    "amount": 5149,
    "currency": "USD",
    "breakdown": {
      "subtotal": 4999,
      "serviceFee": {
        "amount": 150,
        "percentage": 3.0,
        "basis": "creditPercentage"
      }
    }
  }
}

Browse guides

Search documentation

API reference169
Guides131
Knowledge38
legal1
Solutions32
Workflows74
↑↓highlight↵openView all search results

Menu

Theme

Sign out

Your saved plans remain in your organization. This browser’s private draft and account view will be cleared.

Talk to an engineer