How to fix a 400 error code issue in the Pricing API due to mismatched query parameters?
Troubleshooting 400 Error Codes: Resolving Query Parameter Mismatches in the Pricing API for fields such as paymentMethod, fiatCurrency, cryptoCurrency
Overview:
Transak supports over 160 fiat currencies with 20+ local payment options. Each fiat currency has limitations depending on the country and the local payment option level.
For example:
-
The United States (USD) supports local payment options like Cash App.
-
India (INR) supports local payment options like UPI.
How to fetch the supported payment options from a Pricing API based on the Fiat currency?
Step 1: Access the endpoint https://api.transak.com/fiat/public/v1/currencies/fiat-currencies?apiKey=YOUR_API_KEY
Step 2: Look for the paymentOptions array in the response.
For example: Brazil supports Pix, AstroPay, Card Payment, Apple Pay, Google Pay
Step 3: Identify the local payment options supported for a fiat from the paymentOptions array.
"response": [
{
"symbol": "BRL",
"supportingCountries": [
"BR"
],
"logoSymbol": "BR",
"name": "Brazilian Real",
"paymentOptions": [
{
//...
"name": "Pix"
//...
},
{
//...
"name": "AstroPay"
//...
},
{
//...
"name": "Card Payment"
//...
},
{
//...
"name": "Apple Pay"
//...
},
{
//...
"name": "Google Pay"
//...
}
],
"isPopular": true,
"isAllowed": true,
"roundOff": 3,
"icon": "<svg xmlns=\\"<http://www.w3.org/2000/svg\\>" xmlns:xlink=\\"<http://www.w3.org/1999/xlink\\>" width=\\"21px\\" height=\\"15px\\" viewBox=\\"0 0 21 15\\" version=\\"1.1\\">\\n <!-- Generator: sketchtool 46 (44423) - <http://www.bohemiancoding.com/sketch> -->\\n <title>BR</title>\\n <desc>Created with sketchtool.</desc>\\n <defs>\\n <linearGradient x1=\\"50%\\" y1=\\"0%\\" x2=\\"50%\\" y2=\\"100%\\" id=\\"linearGradient-1\\">\\n <stop stop-color=\\"#FFFFFF\\" offset=\\"0%\\"/>\\n <stop stop-color=\\"#F0F0F0\\" offset=\\"100%\\"/>\\n </linearGradient>\\n <linearGradient x1=\\"50%\\" y1=\\"0%\\" x2=\\"50%\\" y2=\\"100%\\" id=\\"linearGradient-2\\">\\n <stop stop-color=\\"#05AB41\\" offset=\\"0%\\"/>\\n <stop stop-color=\\"#019C39\\" offset=\\"100%\\"/>\\n </linearGradient>\\n <linearGradient x1=\\"50%\\" y1=\\"0%\\" x2=\\"50%\\" y2=\\"100%\\" id=\\"linearGradient-3\\">\\n <stop stop-color=\\"#053087\\" offset=\\"0%\\"/>\\n <stop stop-color=\\"#012877\\" offset=\\"100%\\"/>\\n </linearGradient>\\n <circle id=\\"path-4\\" cx=\\"3.5\\" cy=\\"3.5\\" r=\\"3.5\\"/>\\n </defs>\\n <g id=\\"Symbols\\" stroke=\\"none\\" stroke-width=\\"1\\" fill=\\"none\\" fill-rule=\\"evenodd\\">\\n <g id=\\"BR\\">\\n <rect id=\\"FlagBackground\\" fill=\\"url(#linearGradient-1)\\" x=\\"0\\" y=\\"0\\" width=\\"21\\" height=\\"15\\"/>\\n <rect id=\\"Mask-Copy\\" fill=\\"url(#linearGradient-2)\\" x=\\"0\\" y=\\"0\\" width=\\"21\\" height=\\"15\\"/>\\n <path d=\\"M2.42151632,7.77274586 C2.18871929,7.62211248 2.19350487,7.37479097 2.42151632,7.22725414 L10.0784837,2.27274586 C10.3112807,2.12211248 10.6935049,2.12520903 10.9215163,2.27274586 L18.5784837,7.22725414 C18.8112807,7.37788752 18.8064951,7.62520903 18.5784837,7.77274586 L10.9215163,12.7272541 C10.6887193,12.8778875 10.3064951,12.874791 10.0784837,12.7272541 L2.42151632,7.77274586 Z\\" id=\\"Combined-Shape\\" fill=\\"#FDD216\\"/>\\n <g id=\\"Oval-2\\" transform=\\"translate(7.000000, 4.000000)\\">\\n <mask id=\\"mask-5\\" fill=\\"white\\">\\n <use xlink:href=\\"#path-4\\"/>\\n </mask>\\n <use id=\\"Mask\\" fill=\\"url(#linearGradient-3)\\" xlink:href=\\"#path-4\\"/>\\n <path d=\\"M-0.100381226,2.97376324 C0.164901149,2.75894182 1.36252192,2.933788 3.43417519,3.48641101 C4.90835176,3.87965437 6.60707006,4.747859 6.9957681,5.22786103 L7.31042832,5.61643399 L8.08757424,4.98711354 L7.77291401,4.59854058 C7.22285434,3.91927356 5.35175728,2.96296719 3.69191715,2.52019722 C1.10596471,1.83038255 -0.0661252244,1.65926374 -0.7297016,2.19661727 L-1.11827459,2.51127745 L-0.488954213,3.28842343 L-0.100381226,2.97376324 Z\\" id=\\"Line\\" fill=\\"#FFFFFF\\" fill-rule=\\"nonzero\\" mask=\\"url(#mask-5)\\"/>\\n </g>\\n </g>\\n </g>\\n</svg>",
"isPayOutAllowed": true
}
]
FAQs:
1. Bad Request:
1. WHEN fiatCurrency=USD and paymentMethod=sepa_bank_transfer.
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=USD&cryptoCurrency=XRP&isBuyOrSell=BUY&network=mainnet&fiatAmount=500&paymentMethod=sepa_bank_transfer |
| Failure reason: SEPA bank transfer (sepa_bank_transfer) is only available for Euro transactions within Europe. It is not supported for USD transactions. |
2. WHEN fiatCurrency=EUR and paymentMethod=gbp_bank_transfer
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=EUR&cryptoCurrency=BTC&isBuyOrSell=BUY&network=mainnet&fiatAmount=226&paymentMethod=gbp_bank_transfer |
| Failure reason: GBP bank transfer (gbp_bank_transfer) is only available for GBP transactions within United Kingdom. It is not supported for EUR transactions. |
3. WHEN fiatCurrency=EUR and paymentMethod=pm_pix
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=EUR&cryptoCurrency=BTC&isBuyOrSell=BUY&network=mainnet&fiatAmount=226&paymentMethod=pm_pix |
| Failure reason: PIX (pm_pix) is only available for BRL transactions within Brazil. It is not supported for EUR transactions. |
2. Success Request:
1. WHEN fiatCurrency=EUR and paymentMethod=sepa_bank_transfer.
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=EUR&cryptoCurrency=XRP&isBuyOrSell=BUY&network=mainnet&fiatAmount=500&paymentMethod=sepa_bank_transfer |
2. WHEN fiatCurrency=GBP and paymentMethod=gbp_bank_transfer
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=GBP&cryptoCurrency=BTC&isBuyOrSell=BUY&network=mainnet&fiatAmount=226&paymentMethod=gbp_bank_transfer |
3. WHEN fiatCurrency=BRL and paymentMethod=pm_pix
| Endpoint: https://api.transak.com/api/v2/currencies/price?partnerApiKey=YOUR_API_KEY&fiatCurrency=BRL&cryptoCurrency=BTC&isBuyOrSell=BUY&network=mainnet&fiatAmount=226&paymentMethod=pm_pix |