Card Transactions
Understand the card transaction lifecycle, on-chain execution, and webhook notifications.
Before You Start
Read the following guides before proceeding:
| Guide | Why |
|---|---|
| Getting Started | Platform overview and setup |
| Api Basics | Required headers and request configuration |
| Authentication | How to obtain access tokens |
| Onboarding | User and wallet registration |
| KYC | KYC verification requirements |
Overview
When a user makes a card payment, the transaction flows through both on-chain and off-chain systems. This document explains:
- What happens on-chain during a card transaction
- The webhook notifications you receive
- Transaction lifecycle stages
On-Chain Flow
Card transactions execute through the FundsManagement contract, an ERC-7579 executor module installed on the user's Smart Wallet.
Card Debit (User Spending)
When the user makes a purchase:
User's Smart Wallet → FundsManagement Contract → FundsBuffer Contract
(WUSD/WEUR) ExecuteOutgoingTransaction Transfer tokens
- Wirex oracle initiates the transaction
- FundsManagement transfers unified tokens from user's wallet
- Tokens arrive in FundsBuffer (Wirex treasury)
- Transaction hash is recorded
Card Credit (Refund/Reversal)
When a refund or reversal occurs:
FundsBuffer Contract → FundsManagement Contract → User's Smart Wallet
ProcessCreditTransaction (WUSD/WEUR)
- Wirex initiates the credit
- Tokens transfer from FundsBuffer to user's wallet
- Balance restored to user
Tokens Used
| Token | Chain | Description |
|---|---|---|
| WUSD | Base | Unified USD stablecoin (18 decimals) |
| WEUR | Base | Unified EUR stablecoin (18 decimals) |
Token Selection
A card transaction is settled from a single token balance. One transaction is never split across multiple tokens.
Debit (user spending):
- The transaction amount is converted into each token the user holds, using the current exchange rate for that token against the transaction currency. Only tokens that have an available rate are considered.
- Tokens whose available balance cannot cover the full converted amount, or that are inactive, are excluded.
- Among the remaining tokens, the token with the highest ratio of available balance to required amount is selected — the token in which the user holds the largest surplus relative to the amount needed.
Cards are multi-currency — there is no fixed card currency. The transaction arrives in whatever currency the merchant charges, and selection is driven by available balance, not by the transaction currency. A USD transaction can settle from a WEUR balance (converted at the EUR rate) if that balance provides better coverage, and the reverse also applies.
If no single token covers the full amount, the transaction is declined with InsufficientFunds, even when the combined balance across tokens would be sufficient.
Example — transaction of 50.00 USD:
| User balance | Token debited | Reason |
|---|---|---|
| WUSD only | WUSD | Only token that covers the amount |
| WEUR only | WEUR | Only token that covers the amount (converted at EUR rate) |
| 1000 WUSD + 100 WEUR | WUSD | Higher coverage ratio (1000/50 vs ~100/46) |
| 50 WUSD + 1000 WEUR | WEUR | Higher coverage ratio (~1000/46 vs 50/50) |
| 30 WUSD + 30 WEUR | — | Declined — no single token covers 50.00 |
Other transaction currencies: the settlement tokens are always WUSD and WEUR, but a transaction can arrive in any currency the card supports (GBP, JPY, CHF, and others). The amount is converted from the transaction currency into each held token, then the same highest-coverage rule applies — the transaction currency never forces a matching token.
Example — transaction of 50.00 GBP (rates approximate):
| User balance | Converts to | Token debited | Reason |
|---|---|---|---|
| WUSD only | ~63 WUSD | WUSD | Only token that covers the amount |
| WEUR only | ~58 WEUR | WEUR | Only token that covers the amount |
| 500 WUSD + 60 WEUR | ~63 WUSD / ~58 WEUR | WUSD | Higher coverage ratio (500/63 vs 60/58) |
| 40 WUSD + 200 WEUR | ~63 WUSD / ~58 WEUR | WEUR | WUSD balance (40) cannot cover ~63; WEUR covers and is selected |
Example — transaction of 10,000 JPY (rates approximate):
| User balance | Converts to | Token debited | Reason |
|---|---|---|---|
| 200 WUSD + 200 WEUR | ~64 WUSD / ~59 WEUR | WUSD | Higher coverage ratio (200/64 vs 200/59) |
| 100 WUSD + 30 WEUR | ~64 WUSD / ~59 WEUR | WUSD | Only WUSD covers (30 WEUR < ~59) |
Transaction Lifecycle
Card transactions progress through multiple stages:
Initiated → CryptoOut → CardOut → Completed
↓
(on failure/refund)
↓
Reversal
Transaction Stages
| Stage | Description | On-Chain |
|---|---|---|
Initiated | Transaction request received | No |
CryptoOut | Tokens debited from user wallet | Yes |
CardOut | Card network processing complete | No |
Completed | Transaction finalized | No |
Reversal | Tokens returned (failure, partial refund, or full refund) | Yes |
Credit Transaction Stages
For refunds and reversals:
| Stage | Description | On-Chain |
|---|---|---|
Initiated | Credit request received | No |
CardIn | Card network processing | No |
CryptoIn | Tokens credited to user wallet | Yes |
Completed | Credit finalized | No |
Activity Webhook
You receive webhook notifications at each stage of the transaction lifecycle.
Endpoint: POST {your_webhook_base_url}/v2/webhooks/activities
Webhook Payload
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"user_address": "0x1234567890abcdef1234567890abcdef12345678",
"source": {
"type": "Cards",
"card": {
"id": "64120850-73a1-4df5-a074-d463258c9deb",
"pan_last": "1234",
"payment_system": "Visa"
}
},
"destination": {
"type": "Merchant",
"merchant": {
"name": "Amazon",
"category": "Online Shopping",
"country": "US"
}
},
"status": "Completed",
"status_reason": null,
"source_amount": {
"amount": 50.00,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"destination_amount": {
"amount": 50.00,
"currency": "USD"
},
"type": "CardTransaction",
"direction": "Outbound",
"operations": [
{
"hash": "0x209af32b5d8a56fd7a8d6aeb9089f840bff66c74cb9eda3354e771805c05d902",
"operation_amount": {
"amount": -50,
"amount_precise": "-50000000000000000000",
"decimals": 18,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"transaction_amount": {
"amount": -50,
"amount_precise": "-50000000000000000000",
"decimals": 18,
"currency": "USD"
},
"resulting_balance": {
"amount": 950,
"amount_precise": "950000000000000000000",
"decimals": 18,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"rate": {
"ticker": "USD/WUSD",
"rate": 1
},
"status": "Completed",
"operation_reason": "Authorization",
"operation_id": "659bbc8c-1882-45ce-829a-05eb6e235ed6"
}
],
"activity_steps": [
{
"type": "Initiated",
"status": "Completed",
"created_at": "2024-01-15T10:00:00Z",
"completed_at": "2024-01-15T10:00:00Z"
},
{
"type": "CryptoOut",
"status": "Completed",
"created_at": "2024-01-15T10:00:01Z",
"completed_at": "2024-01-15T10:00:05Z"
},
{
"type": "CardOut",
"status": "Completed",
"created_at": "2024-01-15T10:00:05Z",
"completed_at": "2024-01-15T10:00:06Z"
},
{
"type": "Completed",
"status": "Completed",
"created_at": "2024-01-15T10:00:06Z",
"completed_at": "2024-01-15T10:00:06Z"
}
],
"created_at": "2024-01-15T10:00:00Z"
}Payload Fields
| Field | Description |
|---|---|
id | Unique activity identifier |
user_address | User's EOA address |
source | Transaction source (card details) |
destination | Transaction destination (merchant details) |
status | Overall transaction status |
status_reason | Reason for status (set on decline/failure) |
source_amount | Amount debited (crypto for outbound, fiat for inbound) |
destination_amount | Amount received (fiat for outbound, crypto for inbound) |
fee_amount | Card fee charged on the transaction, e.g. the FX fee. Absent when zero; not folded into rate |
rrn | Retrieval reference number assigned by the card network |
type | CardTransaction |
direction | Outbound (debit) or Inbound (credit) |
operations | Balance movements of the transaction: the debit, and any refund or reversal credits |
activity_steps | Ordered list of transaction stages |
Operation Fields
| Field | Description |
|---|---|
operation_id | Stable identifier of the operation. It stays the same in every webhook for that operation, so key your bookings on it |
status | Pending, Completed or Failed. It moves only forward; once Completed or Failed, the operation no longer changes |
operation_reason | Why the operation exists: Authorization, Clearing, Reversal, Refund, Representment, MoneySend, CreditAdjustment, DebitAdjustment, ChargebackRefund, ChargebackReversal |
hash | On-chain transaction hash once the operation is Completed. While it is Pending, it holds an interim value that is not an on-chain hash and is replaced later. Do not use it as an identifier |
operation_amount | Token amount moved, signed: negative for a debit, positive for a credit |
transaction_amount | The same movement in the transaction currency, signed the same way |
resulting_balance | Token balance after the operation. Reliable once the operation is Completed; while Pending it can read 0 |
rate | Rate between the transaction currency and the token |
Every amount carries amount (a display number), amount_precise (the exact value in base units, as a string)
and decimals. Use amount_precise for accounting.
Amount Fields by Direction
The source_amount and destination_amount fields contain different asset types depending on transaction direction:
| Direction | source_amount | destination_amount |
|---|---|---|
Outbound (user spending) | Crypto (token_symbol, token_address) | Fiat (currency) |
Inbound (card receive) | Fiat (currency) | Crypto (token_symbol, token_address) |
Outbound example (user pays $50 with WUSD):
{
"source_amount": { "amount": 50.00, "token_symbol": "WUSD", "token_address": "0x..." },
"destination_amount": { "amount": 50.00, "currency": "USD" }
}Inbound example (user receives $50 via card send):
{
"source_amount": { "amount": 50.00, "currency": "USD" },
"destination_amount": { "amount": 50.00, "token_symbol": "WUSD", "token_address": "0x..." }
}Note: The source_amount and destination_amount fields always use positive values. Until the crypto step (CryptoOut or CryptoIn) is executed, the crypto amount may be 0 or missing from the webhook payload, as it is calculated based on actual on-chain operations.
Operation Amount Signs
The operation_amount and transaction_amount within each operation use signed values to indicate debit or credit:
| Direction | Amount Sign | Example |
|---|---|---|
Outbound (debit) | Negative | -50.00 |
Inbound (credit) | Positive | 50.00 |
This allows you to distinguish the transaction direction from the operation data alone without checking the direction field.
Transaction Status
| Status | Description |
|---|---|
Pending | Transaction in progress, until its debit settles |
Completed | Transaction successful. A partially refunded purchase stays Completed |
Failed | Transaction declined, or refunded / reversed in full. There is no Cancelled status |
Status Reasons
When status is Failed, status_reason indicates why:
| Reason | Description |
|---|---|
InsufficientFunds | User balance too low |
DailySpendAmountIsExceeded | Card spending limit exceeded |
ChainRejected | The on-chain debit was rejected |
GeneralError | Processing error |
BroadcastFailed | The on-chain operation failed |
Webhook Sequence
You may receive multiple webhooks for a single transaction as it progresses through stages. A webhook is sent on
every change to the transaction and always carries its full current state, including all operations. The
transaction status does not change on every webhook: a clearing or a partial refund adds an operation while the
transaction stays Completed.
Successful Debit Transaction
Webhook 1: status=Pending, steps=[Initiated✓]
↓
Webhook 2: status=Pending, steps=[Initiated✓, CryptoOut✓]
↓
Webhook 3: status=Pending, steps=[Initiated✓, CryptoOut✓, CardOut✓]
↓
Webhook 4: status=Completed, steps=[Initiated✓, CryptoOut✓, CardOut✓, Completed✓]
Transaction with Reversal (Failure or Refund)
When a transaction fails after on-chain debit, or when a merchant issues a partial/full refund:
Webhook 1: status=Pending, steps=[Initiated✓]
↓
Webhook 2: status=Pending, steps=[Initiated✓, CryptoOut✓]
↓
Webhook 3: status=Completed, steps=[Initiated✓, CryptoOut✓, CardOut✓, Completed✓]
↓
Webhook 4: status=Completed, steps=[..., Reversal✓] // Partial refund
status=Failed, steps=[..., Reversal✓] // Full refund
Or for immediate failure:
Webhook 1: status=Pending, steps=[Initiated✓, CryptoOut✓]
↓
Webhook 2: status=Failed, steps=[Initiated✓, CryptoOut✓, Reversal✓]
The Reversal step indicates tokens were returned to the user's wallet. Check operations[] for the reversal transaction hash.
Declined at Authorization
Webhook 1: status=Failed, status_reason=DailySpendAmountIsExceeded, steps=[Initiated✓]
No on-chain transaction occurs when declined at authorization.
Refunds
Refunds are not separate transactions. They appear as credit operations within the original debit transaction, indicated by the Reversal step.
When a refund occurs:
- The original transaction webhook is sent again with an additional
Reversalstep - A new operation with positive
operation_amountis added to theoperationsarray - The original debit operation (negative amount) remains in the array
The example below is a full refund, so the transaction reads Failed:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "CardTransaction",
"direction": "Outbound",
"status": "Failed",
"operations": [
{
"hash": "0xabc123...",
"operation_amount": {
"amount": -50.00,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"status": "Completed",
"operation_reason": "Authorization",
"operation_id": "659bbc8c-1882-45ce-829a-05eb6e235ed6"
},
{
"hash": "0xdef456...",
"operation_amount": {
"amount": 50.00,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"status": "Completed",
"operation_reason": "Refund",
"operation_id": "8f0e2a41-5c3d-4b6e-9a7f-1d2c3b4a5e6f"
}
],
"activity_steps": [
{ "type": "Initiated", "status": "Completed" },
{ "type": "CryptoOut", "status": "Completed" },
{ "type": "CardOut", "status": "Completed" },
{ "type": "Completed", "status": "Completed" },
{ "type": "Reversal", "status": "Completed" }
]
}A full refund turns the transaction Failed. For a partial refund the credit operation is smaller than the
debit and status stays Completed.
Original Credit (Card Receive)
Inbound card transactions occur when funds are sent from another card to the user's Wirex card (OriginalCredit). These are separate transactions with direction: Inbound.
{
"type": "CardTransaction",
"direction": "Inbound",
"status": "Completed",
"source_amount": {
"amount": 50.00,
"currency": "USD"
},
"destination_amount": {
"amount": 50.00,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"activity_steps": [
{
"type": "Initiated",
"status": "Completed"
},
{
"type": "CardIn",
"status": "Completed"
},
{
"type": "CryptoIn",
"status": "Completed"
},
{
"type": "Completed",
"status": "Completed"
}
],
"operations": [
{
"hash": "0xdef456...",
"operation_amount": {
"amount": 50.00,
"token_symbol": "WUSD",
"token_address": "0x..."
},
"transaction_amount": {
"amount": 50.00,
"currency": "USD"
},
"rate": {
"ticker": "USD/WUSD",
"rate": 1.0
}
}
]
}Verifying On-Chain Transactions
A Completed operation carries the on-chain transaction hash, which you can verify. Skip Pending
operations: their hash is an interim value, not an on-chain transaction.
// Example: Verify transaction on Base
const txHash = webhook.operations[0].hash;
const receipt = await provider.getTransactionReceipt(txHash);
if (receipt.status === 1) {
console.log('Transaction confirmed on-chain');
}# Example: Verify transaction on Base
tx_hash = webhook["operations"][0]["hash"]
receipt = w3.eth.get_transaction_receipt(tx_hash)
if receipt["status"] == 1:
print("Transaction confirmed on-chain")// Example: Verify transaction on Base
txHash := common.HexToHash(webhook.Operations[0].Hash)
receipt, _ := client.TransactionReceipt(ctx, txHash)
if receipt.Status == 1 {
fmt.Println("Transaction confirmed on-chain")
}Implementation Notes
Idempotency
One transaction produces several webhooks, and the same webhook can arrive more than once.
Deduplicate on each operation's operation_id + status. If you have already processed that pair, skip it.
Each webhook repeats all operations of the transaction. A clearing, refund or reversal arrives as a new operation
with its own operation_id, and an operation that is Completed or Failed never changes again.
Timing
CryptoOut/CryptoInsteps depend on blockchain confirmation- Card network steps (
CardOut/CardIn) depend on issuer processing - Total time varies from seconds to minutes
Balance Updates
- User's on-chain balance updates immediately after
CryptoOut/CryptoIn - Use
operations[].resulting_balanceof aCompletedoperation, or itshash, to query the exact on-chain state
Updated 29 days ago

