DOCS
Build with the API

Calculate payer fees

Show the fee before payment, then send amount and payerFee on the pay call.

Platform guide

If the payer covers a fee, show it before they pay. Call GET /v1/payerFees with the payment amount, display the fee, then include it on the pay call. The endpoint works from the browser with only the account key. See the client script.

Query parameters:

NameUse
amountThe payment amount the fee is calculated from.
cardNumberThe card number, when the fee depends on the card, as with compliant surcharging. Send this or tokenId, not both.
tokenIdA saved card, in place of cardNumber.
accountKeyHeader. The merchant, when you call with your platform credentials. From the browser, it is the only credential.

The response includes payerFees, with one row per payment method configured on the account. Each row has paymentMethodType, percentageFee, flatFee, and total. achFee and cardFee are also returned for those two methods.

How the fee is calculated

For ACH, ACSS, Australian direct debit, BACS, New Zealand direct debit, and SEPA, each payment method has a payer rate, a minimum, and a maximum on the account pricing page. The fee is the rate times the amount. If that falls below the minimum or above the maximum, the response returns a percentageFee of 0 and a flatFee equal to the minimum or maximum. A minimum or maximum of 0 or empty is ignored.

For example, with a rate of 1 percent, a minimum of $2.00, and a maximum of $10.00:

AmountFee returned
$100.00flatFee $2.00, because 1 percent is $1.00, below the minimum
$500.00percentageFee $5.00
$2,000.00flatFee $10.00, because 1 percent is $20.00, above the maximum

To charge the same flat fee on every payment, leave the rate empty and set the minimum and the maximum to that fee. With no rate, the calculated fee is always below the minimum, so the response returns the minimum as flatFee.

For cards, it depends on whether compliant surcharging is on:

  • With compliant surcharging off, the fee is the payer card rate times the amount, plus the payer card transaction fee.
  • With compliant surcharging on, the fee is the account card rate, limited by the caps in Payer fees and compliant surcharging.

Some caps depend on where the payer is. dhango reads the payer's country and state from the request itself (the CF-IPCOUNTRY and CF-REGION headers), so you do not send them. Call the endpoint from the payer's browser for an accurate location.

Pay with the fee included

On POST /v1/transactions/pay and on capture, amount includes the payer fee, and payerFee is the fee you showed. Check payments cannot carry a payer fee.

payer-fees
curl -s -H "accountKey: $ACCOUNT_KEY" \ "https://api.dhangodemo.com/v1/payerFees?amount=100&tokenId=tok_card"