Calculate a surcharge

Calculate a surcharge for a new or existing transaction.

This an upsert endpoint, that will update an existing transaction with a new calculation if the transactionId is provided.

HINT: Calculation errors indicate issues with your integration and potential misuse of the surcharge calculation endpoint - These should be addressed immediately, and should never occur in production.

POST/api/v1/surcharge/

Calculate a surcharge for a new or existing transaction.

This an upsert endpoint, that will update an existing transaction with a new calculation if the transactionId is provided.

HINT: Calculation errors indicate issues with your integration and potential misuse of the surcharge calculation endpoint - These should be addressed immediately, and should never occur in production.

Path Parameters

Yeeld-Accountheader

Either the account.id or external identifier for a merchant account.

This can be used by a platform account to perform actions on behalf of a merchant account.

NOTE: This will be ignored if the request is not made by a registered platform account.

Request Body

object
amountintegerrequired

The pre-tax subtotal amount that will be charged to the customer.

Surcharges should not be calculated on tax so this amount cannot include any taxes that are being collected.

This should be represented in the lowest currency denomination (e.g. if currency is usd, then amount is in cents).

e.g. 10000 (for $100.00 USD)

Example: 10000
currencystring

Three-letter ISO currency code (e.g., usd).

Defaults to usd if not provided.

Must be a supported currency

Example: usd
vendorstring

Payment processing vendor name.

Supported values:

  • adyen
  • auth_net
  • bluesnap
  • braintree
  • chase
  • checkout_com
  • cybersource
  • elavon
  • fiserv
  • global_payments
  • helcim
  • mollie
  • paypal
  • paysafe
  • square
  • stripe
  • tsys
  • worldpay
  • csg_forte
Example: adyen
paymentMethodTypestring

The payment method being used by the customer.

Supported values:

  • acss_debit
  • affirm
  • afterpay_clearpay
  • alipay
  • alma
  • amazon_pay
  • au_becs_debit
  • bacs_debit
  • bancontact
  • billie
  • blik
  • boleto
  • card
  • card_present
  • cashapp
  • customer_balance
  • eps
  • fpx
  • giropay
  • grabpay
  • ideal
  • interac_present
  • kakao_pay
  • klarna
  • konbini
  • kr_card
  • link
  • mobilepay
  • multibanco
  • naver_pay
  • nz_bank_account
  • oxxo
  • p24
  • pay_by_bank
  • payco
  • paypal
  • pix
  • promptpay
  • revolut_pay
  • samsung_pay
  • satispay
  • sepa_debit
  • sofort
  • swish
  • twint
  • us_bank_account
  • wechat_pay
  • zip
Example: card
binstringmin: 6 · max: 8

Card Bin - The first 6 or 8 digits of the card number.

(8 digit bins are preferred for accurate surcharging - If a 6 digit bin has overlap it may result in a zero value surcharge calculation)

bin can be provided to improve the accuracy of surcharge calculations, and is required to compliantly calculate a surcharge in some jurisdictions.

It can also be provided in lieu of cardBrand and cardFunding.

(Note: If cardBrand and cardFunding are provided, these will always supersede the card brand and card funding type from a card bin lookup)

cardBrandstring

The brand of the card being used by the customer.

Supported values:

  • amex
  • diners
  • discover
  • eftpos_au
  • jcb
  • link
  • mastercard
  • unionpay
  • visa
  • american_express
Example: amex
cardFundingstring

The funding source for the card being used by the customer.

Supported values:

  • credit
  • debit
  • prepaid
Example: credit
countrystring

This should be derived from the location of the customer.

Two-letter Alpha-2 ISO country code (e.g., US)

This location may differ depending on the nature of your business and what is being paid for.

For invoices this may be the billing or shipping address on the invoice.

In some cases, it can be the billing address associated with the payment method.

Defaults to US if not provided.

Example: US
stateProvincestring

This should be derived from the location of the customer.

For US states, use two-letter ISO state code (e.g., WA)

This location may differ depending on the nature of your business and what is being paid for.

For invoices this may be the billing or shipping address on the invoice.

In some cases, it can be the billing address associated with the payment method.

NOTE: If a stateProvince is not provided, then it will be derived from the postal code instead. However, providing a stateProvince is recommended for more accurate surcharge calculations.

Example: WA
postalCodestring

This should be derived from the location of the customer.

RECOMMENDED: Please use the stateProvince for the most accurate surcharge calculation.

The postal code should be derived from the location of your patron.

This location may differ depending on the nature of your business and what is being paid for.

For invoices this may be the billing or shipping address on the invoice.

In some cases, it can be the billing address associated with the payment method.

NOTE: The postal code will only be used if a stateProvince is not provided.

Example: 98039
issuerCountrystring

This should be derived from the location of the card issuer.

Two-letter Alpha-2 ISO country code, (e.g., US).

Defaults to US if not provided.

Example: US
transactionIdstring

When requesting a new surcharge calculation for an existing transaction, the transaction ID returned from the initial calculation must be provided.

For example, if the patron changes their payment method then a new calculation should be performed using the same transaction ID.

Example: txn_####
merchantLocationobject

Optional location for the merchant of record.

This is for cases where a merchant account might have multiple locations.

If this is not provided, then the calculation will use the location of the merchant that is configured for the account.

Responses

200Default Response
RequestPOST/api/v1/surcharge/
curl 'https://api.theyeeld.com/api/v1/surcharge/' \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": 10000,
  "currency": "usd",
  "vendor": "adyen",
  "paymentMethodType": "card",
  "bin": "string",
  "cardBrand": "amex",
  "cardFunding": "credit",
  "country": "US",
  "stateProvince": "WA",
  "postalCode": "98039",
  "issuerCountry": "US",
  "transactionId": "txn_####",
  "merchantLocation": {
    "country": "US",
    "stateProvince": "WA"
  }
}'
Response
{
"surcharge": 300,
"transactionId": "txn_####",
"calculationError": {
"message": "string",
"type": "string"
},
"details": {
"resolvedCustomerStateProvince": "WA",
"surchargePercentageRate": 3
},
"calculationWarnings": [
"string"
]
}