Card Authorization API
Implement the authorize and settle endpoints Wirex calls for card transactions of your Master Account corporations.
Before You Start
Read the following guides before proceeding:
| Guide | Why |
|---|---|
| Overview | Understand Master Account mode |
| Cardholders and Cards | How card transactions settle against the Master Account |
How It Works
When a cardholder pays with a card, Wirex first checks the Master Account, then calls your authorize
endpoint. At settlement, Wirex debits the Master Account and calls your settle endpoint.
The contract is the one retail External Authorization uses — see
Authorization API. This page gives it in full, with the differences that apply
to corporations.
sequenceDiagram
participant Cardholder
participant Network as Card Network
participant Wirex as Wirex
participant Master as Master Account
participant Partner as Your API
Cardholder->>Network: Card transaction
Network->>Wirex: Authorization request
Wirex->>Master: Check balance against threshold + amount
alt Below threshold + amount
Wirex-->>Network: Declined
else Enough balance
Wirex->>Partner: POST .../external/authorize
Partner-->>Wirex: { is_allowed: true }
Wirex-->>Network: Authorized
end
Network->>Wirex: Settlement request
par
Wirex->>Master: Debit Master Account
and
Wirex->>Partner: POST .../external/settle
Partner-->>Wirex: { is_processed: true }
end
Wirex-->>Network: Settled
When the Master Account balance is below the threshold plus the amount, Wirex declines the authorization
without calling you.
Endpoints
| Endpoint | Purpose |
|---|---|
POST {your_base_url}/external-authorization/on-chain/card-transaction/external/authorize | Authorize a card transaction |
POST {your_base_url}/external-authorization/on-chain/card-transaction/external/settle | Approve or reject a previously authorized transaction |
{your_base_url} and the API version are configured by Wirex when Master Account mode is enabled. When
the agreed API version is 2, the path is prefixed with /v2:
POST {your_base_url}/v2/external-authorization/on-chain/card-transaction/external/authorize
POST {your_base_url}/v2/external-authorization/on-chain/card-transaction/external/settle
Authentication
Wirex sends no credentials on these calls. Protect the endpoints at network level.
Performance Requirements
| Metric | Requirement |
|---|---|
| Target response time | < 300ms |
| Maximum round trip | 500ms |
| Timeout behavior | Declined (for non-mandatory transactions) |
[!IMPORTANT] Deploy your API in the same region as Wirex (AWS eu-central-1 / Azure west-europe) for optimal latency.
Identity in the Requests
| Field | In Master Account mode |
|---|---|
user_id | The corporation id — the corporation_id returned by POST /api/v1/corporations |
card_id | The card. No employee id is sent, so map card_id to the cardholder yourself |
unique_operation_id | The operation. Use it for idempotency |
Authorization Endpoint
Authorize a card transaction before processing.
POST {your_base_url}/external-authorization/on-chain/card-transaction/external/authorize
Request
{
"transaction_type": "POS",
"user_id": "6f1c2b0e-3a5d-4c7e-9b8a-2d4f6e8a1c3b",
"transaction_id": "a7b2a4b3-2f61-41a7-9f5a-3f3f0b1a3d22",
"operation_type": "Debit",
"card_id": "c0b2c7b1-1d2e-4d7a-9a5d-2b7e3c4d5f66",
"currency": "USD",
"amount": 123.45,
"unique_operation_id": "3e1f6a98-6b0a-4c8c-93e5-0b9c6d2a7f31",
"correlation_id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
"rates_by_assets": [
{
"ticker": "WUSD/EUR",
"buy": 0.8802942779763089356326414065,
"sell": 0.8503191839136152834498511802
},
{
"ticker": "WEUR/EUR",
"buy": 1.005500000000000000000000,
"sell": 0.994500000000000000000000
}
],
"is_mandatory": false,
"related_external_operation_status": "None",
"transaction_reason": "Authorization",
"mcc": "5411"
}| Field | Type | Required | Description |
|---|---|---|---|
transaction_type | string | Yes | Channel type: POS, ATM, ePOS, MoneyTransfer |
user_id | UUID | Yes | Corporation id — the corporation_id of the corporation the card belongs to |
transaction_id | UUID | Yes | Card transaction identifier |
operation_type | string | Yes | Debit (purchase/withdrawal) or Credit (refund) |
card_id | UUID | Yes | Card identifier. Map it to the cardholder yourself — no employee id is sent |
currency | string | Yes | ISO 4217 currency code |
amount | decimal | Yes | Transaction amount |
unique_operation_id | UUID | Yes | Unique operation identifier. Use it for idempotency |
correlation_id | UUID | No | Tracing identifier. Do not require it — treat it as absent when missing |
preferred_payment_currency | string | Yes | ISO 4217 code Wirex prefers to settle in. Empty string when there is no preference |
rates_by_assets | array | Yes | Exchange rates as currency pairs (see below) |
is_mandatory | boolean | Yes | If true, processed regardless of response |
related_external_operation_status | string | Yes | Status of related operation (see below) |
transaction_reason | string | Yes | Transaction reason (see below) |
mcc | string | No | Merchant category code (4-digit string) |
rates_by_assets Values
| Value | Description |
|---|---|
ticker | Currency pair in the format BASE/QUOTE |
buy | Buy rate for the pair |
sell | Sell rate for the pair |
related_external_operation_status Values
| Value | Description |
|---|---|
None | First transaction in the chain |
Rejected | Previous transaction was rejected by partner |
Approved | Previous transaction was approved by partner |
transaction_reason Values
| Value | Description |
|---|---|
Authorization | Authorization operation (single or incremental) |
Clearing | Capture operation (direct, single, or multiple) |
Refund | Refund operation (partial or full) |
Reversal | Cancel authorizations/clearings (partial or full) |
OriginalCredit | Credit operation |
Representment | Cancel refunds/chargebacks |
MoneySend | Credit operation |
DelayAuthorization | Fuel dispenser scenarios or chargebacks |
Response
{
"transaction_id": "a7b2a4b3-2f61-41a7-9f5a-3f3f0b1a3d22",
"is_allowed": true,
"decline_reason": null
}| Field | Type | Required | Description |
|---|---|---|---|
transaction_id | UUID | Yes | Card transaction ID (echo back). Must be a GUID — any other format fails the call and declines the transaction |
is_allowed | boolean | Yes | true to approve, false to decline |
decline_reason | string | No | InsufficientFunds or GeneralError |
Settlement Endpoint
Approve or reject a previously authorized transaction.
POST {your_base_url}/external-authorization/on-chain/card-transaction/external/settle
Request
{
"transaction_type": "POS",
"user_id": "6f1c2b0e-3a5d-4c7e-9b8a-2d4f6e8a1c3b",
"transaction_id": "a7b2a4b3-2f61-41a7-9f5a-3f3f0b1a3d22",
"operation_type": "Debit",
"card_id": "c0b2c7b1-1d2e-4d7a-9a5d-2b7e3c4d5f66",
"currency": "USD",
"amount": 123.45,
"unique_operation_id": "3e1f6a98-6b0a-4c8c-93e5-0b9c6d2a7f31",
"correlation_id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
"settlement_currency": "USD",
"settlement_amount": 123.45,
"settlement_decision": 0,
"reject_reason": null
}| Field | Type | Required | Description |
|---|---|---|---|
transaction_type | string | Yes | Channel type |
user_id | UUID | Yes | Corporation id — the corporation_id of the corporation the card belongs to |
transaction_id | UUID | Yes | Card transaction identifier |
operation_type | string | Yes | Debit or Credit |
card_id | UUID | Yes | Card identifier. Map it to the cardholder yourself |
currency | string | Yes | Original transaction currency |
amount | decimal | Yes | Original transaction amount |
unique_operation_id | UUID | Yes | Unique operation identifier. Use it for idempotency |
correlation_id | UUID | No | Tracing identifier. Do not require it — treat it as absent when missing |
settlement_currency | string | Yes | Settlement currency |
settlement_amount | decimal | Yes | Settlement amount |
settlement_decision | int | Yes | 0 Approve or 1 Reject |
reject_reason | string | No | Reason for rejection (if rejecting) |
Response
{
"is_processed": true,
"error_reason": null,
"transaction_id": "a7b2a4b3-2f61-41a7-9f5a-3f3f0b1a3d22"
}| Field | Type | Required | Description |
|---|---|---|---|
is_processed | boolean | Yes | Whether settlement was processed |
error_reason | string | No | InsufficientFunds or GeneralError |
transaction_id | UUID | Yes | Related transaction ID (echo back). Must be a GUID — any other format fails the call |
Mandatory vs Non-Mandatory Transactions
| Field Value | Authorization Behavior | Settlement Behavior |
|---|---|---|
is_mandatory: false | Requires is_allowed: true | Normal processing |
is_mandatory: true | Processed regardless of response | Processed regardless of response |
Mandatory transactions include refunds, chargebacks, and network corrections. You are notified but cannot
decline them.
Authorization Behavior Summary
| Scenario | Non-Mandatory | Mandatory |
|---|---|---|
is_allowed: true | Processed | Processed |
is_allowed: false | Declined | Processed |
| Timeout (>500ms) | Declined | Processed |
| 5xx error | Declined | Processed |
Implementation Example
The handlers keep one ledger per corporation, keyed by user_id, and one record per operation, keyed by
unique_operation_id.
const basePath = '/external-authorization/on-chain/card-transaction/external';
// Authorization endpoint
app.post(`${basePath}/authorize`, async (req, res) => {
const {
user_id: corporationId,
card_id,
transaction_id,
amount,
currency,
is_mandatory,
unique_operation_id
} = req.body;
// Check idempotency
const existing = await ledger.findOperation(unique_operation_id);
if (existing) {
return res.json({
transaction_id, // echo back unchanged
is_allowed: existing.allowed,
decline_reason: existing.allowed ? null : 'InsufficientFunds'
});
}
// No employee id is sent: resolve the cardholder from your own card_id mapping
const cardholder = await ledger.cardholderByCard(card_id);
// For mandatory transactions, always allow
if (is_mandatory) {
await ledger.recordOperation(unique_operation_id, corporationId, cardholder, amount, currency, true);
return res.json({ transaction_id, is_allowed: true });
}
// Check the corporation's balance in your ledger
const balance = await ledger.getCorporationBalance(corporationId, currency);
const allowed = balance >= amount;
if (allowed) {
await ledger.holdBalance(corporationId, amount, currency, unique_operation_id);
}
await ledger.recordOperation(unique_operation_id, corporationId, cardholder, amount, currency, allowed);
res.json({
transaction_id,
is_allowed: allowed,
decline_reason: allowed ? null : 'InsufficientFunds'
});
});
// Settlement endpoint
app.post(`${basePath}/settle`, async (req, res) => {
const {
transaction_id,
user_id: corporationId,
unique_operation_id,
settlement_amount,
settlement_currency,
settlement_decision
} = req.body;
const operation = await ledger.findOperation(unique_operation_id);
if (!operation) {
return res.json({
is_processed: false,
error_reason: 'GeneralError',
transaction_id
});
}
if (settlement_decision === 0) { // 0 = Approve: book the debit
await ledger.finalizeDebit(corporationId, settlement_amount, settlement_currency, unique_operation_id);
} else { // 1 = Reject: release your hold
await ledger.releaseHold(corporationId, unique_operation_id);
}
res.json({
is_processed: true,
transaction_id
});
});Book the debit only when settlement_decision is 0, and release the hold when it is 1. Store the
booking under unique_operation_id: the activities webhook later carries the same value as
operations[].operation_id, so the movement is not booked twice — see
Cardholders and Cards.
Error Handling
Your API Unavailable
- Non-mandatory transactions: Declined
- Mandatory transactions: Processed anyway
Master Account Below the Threshold
- Wirex declines the authorization without calling your authorize endpoint when the Master Account balance
is below the threshold plus the amount. - Authorization reserves no funds on the Master Account, so the threshold is the only buffer against
concurrent spend. Bank transfers, OCT and FX do not check it — see
Overview.
Updated 8 days ago

