Cost estimation

Use the Adyen Cost Estimation API to pre-calculate interchange and scheme fee costs. Knowing these costs prior actual payment authorisation gives you an opportunity to charge those costs to the cardholder, if necessary.

To retrieve this information, make the call to the /getCostEstimate endpoint. The response to this call contains the amount of the interchange and scheme fees charged by the network for this transaction, and also which surcharging policy is possible (based on current regulations).

Since not all information is known in advance (for example, if the cardholder will successfully authenticate via 3D Secure or if the merchant plans to provide additional Level 2/3 data), the returned amounts are based on a set of assumption criteria defined by the merchant.

Code example

The following example shows how to estimate costs of accepting a 12.34 EUR payment, with 3D Secure enabled and Level 3 data also passed along with the cost estimation request.

Request 

If you are PCI-compliant at Level 1 or 2, you can submit a request with raw card data to the https://pal-test.adyen.com/pal/servlet/BinLookup/getCostEstimation endpoint. 

For information on available request fields, refer to the GetCostEstimateRequest topic.

{
   "amount": {
      "value": 1234,
      "currency": "EUR"
   },
   "assumptions": {
      "assumeLevel3Data": true,
      "assume3DSecureAuthenticated": true
   },
   "cardNumber": "4111111111111111",
   "merchantAccount": "TestMerchant",
   "merchantDetails": {
      "countryCode": "NL",
      "mcc": "7411",
      "enrolledIn3DSecure": true
   },
   "shopperInteraction": "Ecommerce"
}

The following example shows how to submit the cost estimation request with encrypted card data (using Client-Side Encryption):

{
   "amount": {
      "value": 1234,
      "currency": "EUR"
   },
   "assumptions": {
      "assumeLevel3Data": true,
      "assume3DSecureAuthenticated": true
   },
   "encryptedCard": "adyenjs_0_1_4p1$...",
   "merchantAccount": "TestMerchant",
   "merchantDetails": {
      "countryCode": "NL",
      "mcc": "7411",
      "enrolledIn3DSecure": true
   },
   "shopperInteraction": "Ecommerce"
}

Response

The following example shows the sample response with costEstimateAmount equal to 0.25 EUR.

For information on available response fields, refer to the GetCostEstimateResponse topic.

{
   "costEstimateAmount":{
      "currency":"EUR",
      "value":25
   },
   "surchargeType":"PASSTHROUGH",
   "cardBin":{
      "bin":"411111",
      "commercial":false,
      "issuingBank":"Bokf",
      "issuingCountry":"US",
      "issuingCurrency":"USD",
      "paymentMethod":"visa",
      "fundingSource":"CREDIT"
   }
}