Multi-country integration
One merchant account, one set of API credentials, several markets. You do not create a second account to sell into another country — you send a different currency and BitPays routes the order to that market’s local acquirer.
How a market is chosen
Every pay-in and pay-out is matched against your routing rules. A rule names a provider, a flow (PAYIN / PAYOUT) and — crucially — a currency. The currency you send on the request selects the rule, and the rule selects the acquirer.
The country field on your merchant record does not decide this. It only supplies defaults when you omit currency or method. Routing is what picks the market.
| Market | Send currency | Send method | Example amount | Amount unit |
|---|---|---|---|---|
🇮🇳 India IN | INR | UPI | 500 | whole rupees |
🇹🇷 Türkiye TR | TRY | BANK | 750 | whole lira |
🇧🇷 Brazil BR | BRL | BANK | 150 | whole reais |
🇨🇴 Colombia CO | COP | BANK | 80000 | whole pesos |
🇲🇽 Mexico MX | MXN | BANK | 2500 | whole pesos |
🇵🇪 Peru PE | PEN | BANK | 120 | whole soles |
currency, method and the pay-out beneficiary fields change.amount is validated as an integer between 100 and 100000 in the order currency — the same rule for INR, TRY, BRL, COP, MXN and PEN. Sending 150.50 is rejected with 400; send 150. Note this ceiling is low for COP (100000 COP), so confirm per-market limits with your BitPays contact before launch.The wildcard rule — read this before enabling a second market
A routing rule may leave currency empty. An empty currency is a wildcard: it matches every currency, because the engine resolves rules with
OR [ { currency: <requested> }, { currency: null } ]
That is harmless while you sell into one market. The moment a second market is added it becomes a live mis-routing risk: a merchant holding wildcard rules for India will also match a TRY order and hand it to an India-only acquirer, which will reject or mis-process it.
- Pin the existing wildcard rules to the currency they were really for.
- Add rules for the new market, scoped to its currency.
The enable endpoint below performs both halves in one database transaction, so a merchant is never left half-configured.
Enabling a market admin
Requires an admin token with role SUPER_ADMIN or OPS_ADMIN.
Enable
POST /v1/admin/merchants/:id/countries/:code
curl -s -X POST https://api.bitpays.live/v1/admin/merchants/MERCHANT_ID/countries/TR \
-H 'Authorization: Bearer $ADMIN_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"include_payout": true}'
| Body field | Type | Default | Meaning |
|---|---|---|---|
include_payout | boolean | true | Also create pay-out rules for providers that support them. |
pin_existing_to | string | merchant’s own currency | Currency to pin existing wildcard rules to. Override only if the merchant’s wildcards were not for its home market. |
Response
{
"success": true,
"country": "TR",
"currency": "TRY",
"pinnedExistingRules": 7,
"pinnedTo": "INR",
"createdRules": ["provider_d:PAYIN", "provider_d:PAYOUT"],
"message": "Türkiye (TRY) enabled via provider_d. 7 existing wildcard rule(s) were
pinned to INR so the two markets cannot overlap."
}
pinnedExistingRules tells you how many wildcards were narrowed. If it is 0 the merchant was already pinned — which is the healthy steady state.
List enabled markets
GET /v1/admin/merchants/:id/countries
{
"merchant": {
"id": "cmu...", "name": "Acme", "primaryCountry": "IN", "status": "ACTIVE"
},
"countries": [
{
"code": "IN", "name": "India", "currency": "INR",
"enabled": true, "isPrimary": true,
"payinProviders": ["provider_a"], "payoutProviders": ["provider_b", "provider_a"],
"ruleCount": 7, "availableProviders": ["provider_b", "provider_a", "provider_c"]
},
{
"code": "TR", "name": "Türkiye", "currency": "TRY",
"enabled": true, "isPrimary": false,
"payinProviders": ["provider_d"], "payoutProviders": ["provider_d"],
"ruleCount": 2, "availableProviders": ["provider_d"]
}
// ... one entry per supported market, enabled:false when not configured
],
"wildcardRules": [],
"warning": null
}
| Response field | Meaning |
|---|---|
countries[] | One entry per supported market. enabled is true when at least one active pay-in rule exists for that currency; isPrimary marks the merchant’s own country. |
availableProviders | Acquirers that are ACTIVE for that market — i.e. what the market could be enabled with. |
wildcardRules[] | Rules with no currency set. A non-empty array is the problem to fix — each one matches every currency. |
warning | Plain-language description of the wildcard risk, or null when there is none. |
wildcardRules is [] and warning is null. Anything else means an order in an unconfigured currency could be handed to the wrong acquirer.Disable a market
DELETE /v1/admin/merchants/:id/countries/:code
Deactivates that market’s rules. They are kept, not deleted, so re-enabling restores the previous provider mix and the history stays intact.
ACTIVE provider for it returns 400. Activate the acquirer first.Integrating against two markets
Nothing about your credentials or endpoints changes. Send the market’s currency and method:
🇮🇳 India INR
curl -s -X POST https://api.bitpays.live/v1/payin/create \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: in-order-1001' \
-d '{
"merchant_order_id": "ORDER-1001",
"amount": 500,
"currency": "INR",
"method": "UPI",
"customer": { "name": "Test User", "email": "user@example.com" }
}'
🇹🇷 Türkiye TRY
curl -s -X POST https://api.bitpays.live/v1/payin/create \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: tr-order-1001' \
-d '{
"merchant_order_id": "ORDER-1001",
"amount": 750,
"currency": "TRY",
"method": "BANK",
"customer": { "name": "Test User", "email": "user@example.com" }
}'
The response shape is the same in both cases. Follow the returned checkout/instruction payload for that market — a UPI QR in India, bank-transfer instructions in Türkiye — and wait for the webhook.
If a currency is not enabled
If no rule matches the currency you sent, the order is rejected rather than mis-routed:
HTTP/1.1 503 Service Unavailable
{
"success": false,
"code": "PAYMENT_TEMPORARILY_UNAVAILABLE",
"message": "Payment processing is temporarily unavailable. Please try again shortly."
}
This is the intended, safe outcome: a clean failure beats sending a Turkish lira order to an Indian acquirer. If you see it for a market you expect to be live, the market has not been enabled for your account.
Staging and the simulated channel
Staging has its own database, its own merchant accounts and its own credentials; your production keys will not work there. It is not isolated from real money: unless your staging account is routed to the simulated channel below, staging orders go to the same live acquirers as production.
Simulated channel (only when enabled for your staging account)
BitPays can route a staging account to a simulated channel. It is not on by default; ask your BitPays contact whether it applies to your account and market before relying on it. Orders routed to it settle deterministically from the last two digits of the integer part of the amount:
| Amount ends in | Outcome | Use it to test |
|---|---|---|
…11 | FAILED | Your failure path and payment.failed webhook. |
…22 | PENDING (stays pending) | Timeout and expiry handling. |
| anything else | SUCCESS | The happy path and payment.success. |
So 511 fails, 522 hangs, 500 succeeds. The simulator makes no network calls and moves no money.
Go-live checklist for a new market
- Confirm an
ACTIVEprovider exists for the country. GET /v1/admin/merchants/:id/countries— readwarningandwildcardRules.POST …/countries/:code— pins wildcards and adds the new market in one transaction.- Re-run the
GET— the new market showsenabled: trueandwildcardRulesis[]. - Create one small live order in the new currency and confirm it reaches the right acquirer.
- Confirm the webhook arrives with the new
currencyechoed back.
Per-market request, checkout and pay-out field details: India · Türkiye · Brazil · Colombia · Mexico · Peru.