A single REST API for UPI & bank collections and payouts. Integrate server-to-server (H2H) — your backend calls ours directly, we return a payment link or UPI intent, and we notify you of the final result over signed webhooks.
Production liveBase /v1Auth Bearer JWTAmounts whole ₹ INRContent-Type application/json
How the flow works You authenticate with API keys → create a payment → show the customer the returned UPI intent / hosted checkout → we push a payment.success webhook the moment it clears. Everything below is copy-paste ready.
🌎 One API, six markets BitPays supports 🇮🇳 India, 🇹🇷 Türkiye, 🇧🇷 Brazil, 🇨🇴 Colombia, 🇲🇽 Mexico & 🇵🇪 Peru through this same API — see Countries & payment methods for each market's currency, method, payment instrument and pay-out fields. Code samples below use India (INR / UPI); swap currency + method for other markets. Every market also has its own page covering that country's exact request, checkout and test-mode behaviour: India, Türkiye, Brazil, Colombia, Mexico, Peru.
🌍 Selling into more than one market? One account and one set of credentials can serve several countries — you send a different currency and BitPays routes to that market’s acquirer. Multi-country integration → covers how a market is enabled, the wildcard-rule trap to avoid, and how to test each market.
Countries & payment methods
One API, every market. The endpoints, authentication, idempotency and webhooks in this guide are identical everywhere — only the currency and method you send change. BitPays routes each request to the correct local rail automatically.
Amount unitsamount is an integer in every market — the whole major unit of the order currency, never minor units and never decimals. 500 means ₹500, 150 means R$ 150, 80000 means COP 80 000. A decimal such as 150.50 is rejected with 400. The validated range is 100–100000 in the order currency; per-merchant limits may be lower.
Pay-in — what the response gives you
Market
Response contains
Show the customer
🇮🇳 India
payment_url + intent_uri (upi://) + QR
UPI intent / QR, or the hosted page
🇧🇷 Brazil
qr_payload = PIX EMV (copia e cola)
Render the PIX QR + a copy button
🇨🇴 Colombia
qr_payload = Bre-B EMV QR
Render the Bre-B QR + a copy button
🇲🇽 Mexico
CLABE account + receiving bank (SPEI)
Show the CLABE, amount & concept “pago”
🇵🇪 Peru · 🇹🇷 Türkiye
payment_url (hosted checkout)
Redirect the customer to payment_url
Pay-out — beneficiary fields by country
Send the common fields (amount, currency, method, merchant_payout_id) plus a beneficiary object. The local bank / PIX / CLABE details go under beneficiary (or order metadata):
Country
Beneficiary fields
🇮🇳 India
name, phone (10-digit mobile — required by some rails), upi_id — or account_number + ifsc
Every terminal webhook carries the utr Both payment.success and payout.success include the bank / UPI reference (utr) once the provider settles.
Quickstart
Three calls take you from zero to a live payment. These calls create real orders — there is no test mode, and staging is connected to live payment channels too.
1
Get your API keys
From the merchant dashboard → API Keys, copy your client_id (bp_live_…; older accounts aqp_live_…) and client_secret (sk_live_…). The secret is shown once — store it securely.
2
Exchange them for a bearer token
POST /v1/auth/token returns a JWT valid for 1 hour. Send it as Authorization: Bearer … on every other call.
3
Create your first payment
POST /v1/payin/create returns an order_id, a hosted payment_url and a UPI intent_uri. Show one to the customer and wait for the webhook.
Two stacks with independent keys and data and an identical request/response contract. Both are connected to live payment channels.
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. BitPays can route a staging account to a simulated channel on request — treat staging as live unless BitPays has confirmed that in writing for your account and market.
● Staging (pre-production)
https://api.staging.bitpays.live
Pre-production, with separate keys from the staging dashboard. Connected to live payment channels — transactions may move real money.
● Production
https://api.bitpays.live
Live money movement. Use production keys and whitelist your server IP before going live.
Detail
Value
Path prefix
/v1 on every endpoint
Amounts
Integer whole units of the currency — 500 INR means ₹500, not paise
Keep secrets server-side Never expose production or staging API keys or webhook secrets in a browser or mobile app.
Authentication
All API calls are authenticated with a short-lived bearer JWT. Exchange your API keys for a token, then send that token on every request. Tokens live for 1 hour; there is no separate refresh token — call /v1/auth/token again (or /v1/auth/refresh) with the same keys to mint a new one.
POST/v1/auth/token
Field
Type
Req.
Notes
client_id
string
required
Your client ID, bp_live_… (older accounts aqp_live_…)
Guardrails The token endpoint is rate-limited to 20 requests / 60s. Bad keys return 401INVALID_CREDENTIALS; a suspended account returns 403MERCHANT_SUSPENDED.
Idempotency
Every create call (payin and payout) accepts an x-idempotency-key header. Send a unique key (a UUID) per logical order and safely retry on network failures — a repeated key returns the original result instead of creating a duplicate.
Behaviour Same key + same payload → the original response (HTTP 200 replay). Same key + a different payload → 409IDEMPOTENCY_CONFLICT. Reusing a merchant_order_id across different keys → 409DUPLICATE_ORDER.
Create a payment (collect)
Creates a UPI or bank collection order and returns the artifacts you present to the customer: a hosted payment_url, a UPI intent_uri, and a scannable qr_payload. The order expires at expires_at — 15 minutes by default, 30 minutes for TRY — after creation.
payment_url, intent_uri and qr_payload appear only when applicable to the chosen method. Do not treat the create response as final — always wait for the payment.success webhook (or poll status).
Common errors422METHOD_NOT_SUPPORTED (use UPI/BANK) · 403PAYIN_DISABLED · 409DUPLICATE_ORDER · 503PAYMENT_TEMPORARILY_UNAVAILABLE.
Payment status
Poll for the current state of a collection. Webhooks are the primary, real-time signal — use polling only as a reconciliation fallback.
Also available: POST/v1/payin/{order_id}/refund — refunds a success order, fully or partly (else 409NOT_REFUNDABLE). See Refund a payin.
Create a payout (disburse)
Sends money to a beneficiary by UPI or bank transfer. The payout is created in PENDING and the amount is debited from your payout wallet immediately; funds are released to the provider on approval.
POST/v1/payout/create
Headers: same as payin — Bearer token, JSON, optional x-idempotency-key.
Field
Type
Req.
Rules
amount
integer
required
Whole INR; min ₹1, max ₹100,000
method
enum
required
UPI · BANK · WALLET
beneficiary
object
conditional
See rules below
beneficiary.phone
string
optional
Beneficiary mobile. Send it for India — some India payout rails refuse a payout without a 10-digit mobile. beneficiary.mobile is accepted as an alias
merchant_payout_id
string
optional
Your reference; auto-generated if omitted
currency
string
optional
Defaults INR
remarks
string
optional
≤255 chars
metadata
object
optional
Free-form
Beneficiary rulesmethod: "UPI" requires beneficiary.upi_id. method: "BANK" requires beneficiary.account_numberandbeneficiary.ifsc. Missing fields → 422. beneficiary.phone is optional platform-wide, but an India payout that reaches a rail which requires it fails at the provider — send it whenever you have it.
We POST a JSON event to your configured endpoint the moment an order reaches a terminal state. Webhooks are the source of truth for payment outcomes — never mark an order paid off the create response alone.
Payout events key on payout_id / merchant_payout_id (not order_id). Respond 2xx to acknowledge. Non-2xx or a timeout (10s) triggers retries: up to 9 attempts with backoff 30s → 1m → 5m → 15m → 30m → 1h → 3h → 6h → 12h, with backup-URL failover.
Verify webhook signatures
Every webhook is signed so you can confirm it came from BitPays and wasn't tampered with. Compute an HMAC-SHA256 over "{timestamp}.{rawBody}" using your webhook signing secret (whsec_…) and compare it, in constant time, to the x-aquapay-signature header.
Signed stringsignature = HMAC_SHA256( secret, timestamp + "." + rawBody ) — hex-encoded. Use the exact raw request bytes, before any JSON re-serialization. timestamp is the value of the x-aquapay-timestamp header.
Express — verify & handle
import express from"express";
import crypto from"crypto";
const SECRET = process.env.BITPAYS_WEBHOOK_SECRET; // whsec_...// capture the RAW body — required for signature verification
app.post("/webhooks/bitpays",
express.raw({ type: "application/json" }),
(req, res) => {
const ts = req.header("x-aquapay-timestamp");
const sig = req.header("x-aquapay-signature");
const raw = req.body.toString("utf8");
const expected = crypto.createHmac("sha256", SECRET)
.update(`${ts}.${raw}`).digest("hex");
const ok = sig && crypto.timingSafeEqual(
Buffer.from(sig), Buffer.from(expected));
if (!ok) return res.sendStatus(400);
const event = JSON.parse(raw);
if (event.event === "payment.success") {
// idempotent: mark order paid by event.merchant_order_id
}
res.sendStatus(200); // ack fast
});
Flask
import hmac, hashlib
from flask import request, abort
SECRET = os.environ["BITPAYS_WEBHOOK_SECRET"].encode()
@app.post("/webhooks/bitpays")
def bitpays():
ts = request.headers["x-aquapay-timestamp"]
sig = request.headers.get("x-aquapay-signature", "")
raw = request.get_data(as_text=True)
expected = hmac.new(SECRET, f"{ts}.{raw}".encode(),
hashlib.sha256).hexdigest()
if not hmac.compare_digest(sig, expected):
abort(400)
event = request.get_json()
# handle event["event"] idempotentlyreturn"", 200
Best practice Acknowledge with 2xx immediately and process asynchronously. Treat every event as at-least-once — dedupe on delivery_id (or merchant_order_id + event). Secrets rotate with a version window, so keep verifying the current secret and accept a brief overlap during rotation.
Disputes — raise a UTR query
When a customer says they paid but the order is still pending, submit the UTR (bank reference) for that transaction and we open a dispute your team can action. A payment screenshot is optional — when you include one we store it and return a signed document_url (valid ~7 days). Authenticate with the same bearer token from /v1/auth/token.
document_url is returned only when you sent a screenshot; it is a signed link valid ~7 days. The dispute also appears in your Disputes dashboard and, if you have linked a Telegram group, pops into that group.
List & track
GET/v1/disputes
Paginated list of your disputes. Filter with ?status=, ?priority= or ?query=.
GET/v1/disputes/{id}
A single dispute with its full event timeline and attachments.
Mint a fresh signed download_url for an attachment later (the link from create expires).
Errors422utr is required when no UTR is sent · 404ORDER_NOT_FOUND when payin_order_id doesn't belong to you · 413SCREENSHOT_TOO_LARGE above 10 MB.
Embed the cashier in an iframe
The hosted cashier can run inside an <iframe> on your own checkout, so the customer never leaves your site. Put the payment_url returned by /v1/payin/create straight into the frame.
Allow clipboard-write The India cashier offers a “copy UPI ID” button. Without that allow attribute the copy silently fails inside a frame.
Knowing when the payment finished
When the payment reaches a final state the cashier navigates itself to a result page. Inside a frame that only swaps the frame’s document — your page is not reloaded and would otherwise never find out. So the embedded page posts a message to its parent:
window.addEventListener('message', function (event) {
// Always check the origin before trusting a postMessage.
if (event.origin !== 'https://api.bitpays.live') return;
var msg = event.data;
if (!msg || msg.source !== 'bitpays') return;
if (msg.type === 'cashier_ready') {
// The cashier rendered. msg.order_id is available.
return;
}
if (msg.type === 'payment_status') {
// msg.status is 'success' | 'failed' | 'expired'
if (msg.status === 'success') {
window.location = '/order/complete?order=' + encodeURIComponent(msg.order_id);
}
}
});
Field
Values
Meaning
source
"bitpays"
Always this. Ignore any message without it.
type
cashier_ready · payment_status
cashier_ready fires once when the cashier loads; payment_status when the order reaches a final state.
status
pending · success · failed · expired
pending accompanies cashier_ready.
order_id
string
The BitPays order id.
The message is a UI signal, not proof of payment It comes from the browser, so it can be forged by anything running on the page. Use it to update what the customer sees — close the frame, show a receipt, move them on. Credit the order only on the signed webhook or a server-side status check.
Restricting who may embed
By default any site may frame the cashier (Content-Security-Policy: frame-ancestors *). To limit it to your own domains, ask BitPays support to set an explicit allowlist — framing from anywhere else is then refused by the browser. Only the /checkout/* pages are framable; the dashboards are not, and never will be.
Full-page alternative You do not have to embed. Redirecting the customer to payment_url and relying on return_url works too, and is simpler if you have no need to keep them on your page.
API reference
Every public endpoint, with its exact fields, validation, responses and errors. Base URL https://api.bitpays.live; every path is under /v1. Request and response bodies are JSON. Field names, codes and statuses below are taken from the API implementation; anything that could not be verified is marked Requires confirmation.
There is no payment-methods endpoint: the methods for each market are listed in Countries & methods and the country guides. There is no official BitPays SDK; the examples use each language’s standard HTTP client.
Authentication
POST/v1/auth/token
Get an access token
Exchange your API credentials for a short-lived bearer token. Tokens are valid for 3600 seconds; request a new one before expiry.
Authentication
None — credentials go in the body. Limited to 20 requests per 60 s by default.
Headers
Header
Required
Value
Content-Type
required
application/json
Request body · application/json
Field
Type
Required
Validation & notes
client_id
string
required
Your client ID (bp_live_…; older accounts aqp_live_…). Non-empty.
Creates a collection order and returns what you present to the customer: a hosted payment_url and, where the market supports it, a UPI intent_uri / qr_payload. Credit the customer on the payment.success webhook, never on this response.
Authentication
Bearer token from POST /v1/auth/token in the Authorization header.
Headers
Header
Required
Value
Authorization
required
Bearer {access_token}
Content-Type
required
application/json
x-idempotency-key
recommended
Unique per logical order (a UUID). Same key + same body replays the original response with HTTP 200; same key + different body is 409 IDEMPOTENCY_CONFLICT.
Request body · application/json
Field
Type
Required
Validation & notes
amount
integer
required
Whole units of the currency (no decimals, not paise). Per-currency band: INR 100–100,000 · TRY 40–200,000 · BRL 5–30,000 · MXN 20–100,000 · COP 4,000–20,000,000 · PEN 4–20,000. Your account’s own min/max may be narrower.
currency
string
required
3-letter ISO code of the market: INR, TRY, BRL, MXN, COP, PEN.
method
enum
required
UPI · CARD · BANK · WALLET. Use the method listed for the market in Countries.
merchant_order_id
string
optional
1–100 chars, unique per merchant. Generated if omitted.
customer
object
optional
name (≤100), full_name (≤100, alias of name), email (valid email), phone (≤20). Türkiye TRY + BANK requires a full name (first and last).
return_url
string (URL)
optional
Where the hosted checkout sends the customer afterwards.
200 Idempotent replay — the original response for a repeated x-idempotency-key
Optional fields appear only when the channel supplies them: intent_uri, qr_payload, app_intents (app-specific deep links), collectible_amount (when the channel asks the payer for a slightly different amount — display this one), and bank_transfer (beneficiary_iban, beneficiary_name, bank_name, amount, currency) when raw_requisites was requested. expires_at is 15 minutes after creation by default and 30 minutes for TRY.
Errors
Every error body is { "success": false, "code": "…", "message": "…" }. Branch on code; retry only 5xx and 429.
HTTP
code
When
400
INVALID_REQUEST
A required field is missing or has the wrong JSON type (message: “Invalid request.”).
422
INVALID_REQUEST
Validation failed (message: “Validation failed”). details maps field → messages; issues[] carries a stable code for issues that define one.
No route is enabled for this currency and method on your account — permanent until enabled; do not retry.
422
AMOUNT_OUTSIDE_LIMITS
No available channel accepts this amount.
403
PAYIN_DISABLED
Collections are switched off for your account.
403
COUNTRY_NOT_ENABLED
The market is not enabled for your account. Body adds country and reason.
409
IDEMPOTENCY_CONFLICT
Key reused with a different body.
409
DUPLICATE_ORDER
merchant_order_id already exists.
503
PAYMENT_TEMPORARILY_UNAVAILABLE
No channel has capacity, or the provider rejected the attempt. When an order was created it is failed and the body adds order_id, merchant_order_id, optional reason and retryable. A provider-specific code may appear instead.
401
UNAUTHORIZED
Missing, malformed or expired bearer token.
401
SESSION_REVOKED
Your session was ended (for example “log out all devices”). Get a new token.
403
MERCHANT_SUSPENDED
The merchant account is suspended.
403
IP_NOT_WHITELISTED
An IP allow-list is set and the calling IP is not on it.
429
RATE_LIMIT_EXCEEDED
Too many requests in the window — back off and retry.
Statuses
New orders are created or pending, then become success, failed or expired.
Idempotency
Supported via x-idempotency-key. Same key and body within the retention window returns the original response with HTTP 200 and creates nothing new; a different body is 409 IDEMPOTENCY_CONFLICT. Generate a new key per logical order. Requires confirmation the key retention period is not published.
Sends money to a beneficiary. The amount is debited from your payout wallet when the order is created; a failed payout returns it.
Authentication
Bearer token from POST /v1/auth/token in the Authorization header.
Headers
Header
Required
Value
Authorization
required
Bearer {access_token}
Content-Type
required
application/json
x-idempotency-key
recommended
Unique per logical order (a UUID). Same key + same body replays the original response with HTTP 200; same key + different body is 409 IDEMPOTENCY_CONFLICT.
Request body · application/json
Field
Type
Required
Validation & notes
amount
integer
required
Whole units of the currency. Per-currency band: INR 1–100,000 · TRY 40–200,000 · BRL 5–30,000 · MXN 20–100,000 · COP 4,000–20,000,000 · PEN 4–20,000.
method
enum
required
BANK · UPI · WALLET.
currency
string
optional
3-letter ISO code. Defaults to INR.
merchant_payout_id
string
optional
1–100 chars, your reference. merchant_order_id is accepted as an alias. Generated if omitted.
beneficiary
object
conditional
name, phone (or alias mobile; 7–15 digits), account_number, ifsc, iban, upi_id. Rules: UPI needs upi_id; BANK needs account_number or iban, and INR bank payouts also need ifsc; WALLET needs account_number or upi_id.
200 Idempotent replay — the original response for a repeated x-idempotency-key
Errors
Every error body is { "success": false, "code": "…", "message": "…" }. Branch on code; retry only 5xx and 429.
HTTP
code
When
400
INVALID_REQUEST
A required field is missing or has the wrong JSON type (message: “Invalid request.”).
422
INVALID_REQUEST
Validation failed (message: “Validation failed”). details maps field → messages; issues[] carries a stable code for issues that define one.
422
INVALID_REQUEST + issues[].code
AMOUNT_BELOW_MINIMUM / AMOUNT_ABOVE_MAXIMUM; beneficiary rule messages are in details.
422
INSUFFICIENT_BALANCE
Your payout wallet cannot cover the amount.
403
PAYOUT_DISABLED
Payouts are switched off for your account.
403
COUNTRY_NOT_ENABLED / FLOW_NOT_ENABLED_IN_MARKET
The market, or payouts in that market, are not enabled for your account.
409
IDEMPOTENCY_CONFLICT
Key reused with a different body.
409
DUPLICATE_ORDER
merchant_payout_id already exists.
401
UNAUTHORIZED
Missing, malformed or expired bearer token.
401
SESSION_REVOKED
Your session was ended (for example “log out all devices”). Get a new token.
403
MERCHANT_SUSPENDED
The merchant account is suspended.
403
IP_NOT_WHITELISTED
An IP allow-list is set and the calling IP is not on it.
429
RATE_LIMIT_EXCEEDED
Too many requests in the window — back off and retry.
Statuses
Payouts start pending, move through processing and end success or failed.
Idempotency
Supported via x-idempotency-key. Same key and body within the retention window returns the original response with HTTP 200 and creates nothing new; a different body is 409 IDEMPOTENCY_CONFLICT. Generate a new key per logical order. Requires confirmation the key retention period is not published.
When a screenshot was stored, attachment_id and a signed document_url (valid 7 days, document_expires_in = 604800) are returned. A warning appears if the upload failed but the dispute was still created.
Errors
Every error body is { "success": false, "code": "…", "message": "…" }. Branch on code; retry only 5xx and 429.
HTTP
code
When
422
INVALID_REQUEST
Validation failed (message: “Validation failed”). details maps field → messages; issues[] carries a stable code for issues that define one.
404
ORDER_NOT_FOUND
The referenced transaction was not found on your account.
422
BAD_SCREENSHOT
screenshot_base64 could not be decoded.
422
SCREENSHOT_FETCH_FAILED
screenshot_url could not be fetched.
413
SCREENSHOT_TOO_LARGE
The screenshot exceeds 10 MB.
401
UNAUTHORIZED
Missing, malformed or expired bearer token.
401
SESSION_REVOKED
Your session was ended (for example “log out all devices”). Get a new token.
403
MERCHANT_SUSPENDED
The merchant account is suspended.
403
IP_NOT_WHITELISTED
An IP allow-list is set and the calling IP is not on it.
429
RATE_LIMIT_EXCEEDED
Too many requests in the window — back off and retry.
Examples
curl -X POST https://api.bitpays.live/v1/disputes \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"payin_order_id": "cmabc123payin0001",
"utr": "402912345678",
"amount": 1500,
"currency": "INR",
"description": "Paid but order still pending"
}'
const res = await fetch("https://api.bitpays.live/v1/disputes", {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"payin_order_id": "cmabc123payin0001",
"utr": "402912345678",
"amount": 1500,
"currency": "INR",
"description": "Paid but order still pending"
}),
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.message}`);
Optionally lock API access to specific source IPs from the merchant dashboard → Security. When set, calls from any other IP return 403IP_NOT_WHITELISTED. Leave it empty to allow all IPs. Whitelist your production server's egress IP before going live.
BitPays Payments API · v1 · server-to-server integration. Amounts in whole units of the currency. Base URLs — production api.bitpays.live, staging api.staging.bitpays.live (pre-production, connected to live payment channels). Keep API keys and webhook secrets server-side only.