BitPays Docs

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.

Base https://api.bitpays.live Staging (live channels) https://api.staging.bitpays.live Auth Bearer JWT

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.

MarketSend currencySend methodExample amountAmount unit
🇮🇳 India ININRUPI500whole rupees
🇹🇷 Türkiye TRTRYBANK750whole lira
🇧🇷 Brazil BRBRLBANK150whole reais
🇨🇴 Colombia COCOPBANK80000whole pesos
🇲🇽 Mexico MXMXNBANK2500whole pesos
🇵🇪 Peru PEPENBANK120whole soles
Same endpoints everywhere Authentication, idempotency, webhooks, status polling and error shapes are identical in every market. Only currency, method and the pay-out beneficiary fields change.
Amounts are whole numbers in every market 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.

Enabling a market has two halves
  1. Pin the existing wildcard rules to the currency they were really for.
  2. Add rules for the new market, scoped to its currency.
Doing only the second is the trap. Pinning only ever narrows a rule, so existing traffic is unaffected.

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 fieldTypeDefaultMeaning
include_payoutbooleantrueAlso create pay-out rules for providers that support them.
pin_existing_tostringmerchant’s own currencyCurrency 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 fieldMeaning
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.
availableProvidersAcquirers 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.
warningPlain-language description of the wildcard risk, or null when there is none.
Healthy steady state 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.

A market needs an active provider Enabling a country with no 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 is not a sandbox Staging is a pre-production environment connected to live payment channels. Transactions initiated in staging may move real money. Do not use staging for test payments or payouts.

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.

Staging base https://api.staging.bitpays.liveProduction base https://api.bitpays.live

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 inOutcomeUse it to test
…11FAILEDYour failure path and payment.failed webhook.
…22PENDING (stays pending)Timeout and expiry handling.
anything elseSUCCESSThe happy path and payment.success.

So 511 fails, 522 hangs, 500 succeeds. The simulator makes no network calls and moves no money.

The simulated channel is per routing rule, not automatic An order only reaches the simulator if your staging account has a routing rule pointing that currency at it. A staging account routed to a real acquirer uses that acquirer’s live credentials: the payment is real and the amount-suffix convention does not apply. Ask your BitPays contact which markets, if any, are wired to the simulator for your staging account.

Go-live checklist for a new market

  1. Confirm an ACTIVE provider exists for the country.
  2. GET /v1/admin/merchants/:id/countries — read warning and wildcardRules.
  3. POST …/countries/:code — pins wildcards and adds the new market in one transaction.
  4. Re-run the GET — the new market shows enabled: true and wildcardRules is [].
  5. Create one small live order in the new currency and confirm it reaches the right acquirer.
  6. Confirm the webhook arrives with the new currency echoed back.

Per-market request, checkout and pay-out field details: India · Türkiye · Brazil · Colombia · Mexico · Peru.