Card Transactions

Understand the card transaction lifecycle, on-chain execution, and webhook notifications.

Before You Start

Read the following guides before proceeding:

GuideWhy
Getting StartedPlatform overview and setup
Api BasicsRequired headers and request configuration
AuthenticationHow to obtain access tokens
OnboardingUser and wallet registration
KYCKYC 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
  1. Wirex oracle initiates the transaction
  2. FundsManagement transfers unified tokens from user's wallet
  3. Tokens arrive in FundsBuffer (Wirex treasury)
  4. 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)
  1. Wirex initiates the credit
  2. Tokens transfer from FundsBuffer to user's wallet
  3. Balance restored to user

Tokens Used

TokenChainDescription
WUSDBaseUnified USD stablecoin (18 decimals)
WEURBaseUnified 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):

  1. 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.
  2. Tokens whose available balance cannot cover the full converted amount, or that are inactive, are excluded.
  3. 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 balanceToken debitedReason
WUSD onlyWUSDOnly token that covers the amount
WEUR onlyWEUROnly token that covers the amount (converted at EUR rate)
1000 WUSD + 100 WEURWUSDHigher coverage ratio (1000/50 vs ~100/46)
50 WUSD + 1000 WEURWEURHigher 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 balanceConverts toToken debitedReason
WUSD only~63 WUSDWUSDOnly token that covers the amount
WEUR only~58 WEURWEUROnly token that covers the amount
500 WUSD + 60 WEUR~63 WUSD / ~58 WEURWUSDHigher coverage ratio (500/63 vs 60/58)
40 WUSD + 200 WEUR~63 WUSD / ~58 WEURWEURWUSD balance (40) cannot cover ~63; WEUR covers and is selected

Example — transaction of 10,000 JPY (rates approximate):

User balanceConverts toToken debitedReason
200 WUSD + 200 WEUR~64 WUSD / ~59 WEURWUSDHigher coverage ratio (200/64 vs 200/59)
100 WUSD + 30 WEUR~64 WUSD / ~59 WEURWUSDOnly WUSD covers (30 WEUR < ~59)

Transaction Lifecycle

Card transactions progress through multiple stages:

Initiated  →  CryptoOut  →  CardOut  →  Completed
                                            ↓
                                       (on failure/refund)
                                            ↓
                                        Reversal

Transaction Stages

StageDescriptionOn-Chain
InitiatedTransaction request receivedNo
CryptoOutTokens debited from user walletYes
CardOutCard network processing completeNo
CompletedTransaction finalizedNo
ReversalTokens returned (failure, partial refund, or full refund)Yes

Credit Transaction Stages

For refunds and reversals:

StageDescriptionOn-Chain
InitiatedCredit request receivedNo
CardInCard network processingNo
CryptoInTokens credited to user walletYes
CompletedCredit finalizedNo

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

FieldDescription
idUnique activity identifier
user_addressUser's EOA address
sourceTransaction source (card details)
destinationTransaction destination (merchant details)
statusOverall transaction status
status_reasonReason for status (set on decline/failure)
source_amountAmount debited (crypto for outbound, fiat for inbound)
destination_amountAmount received (fiat for outbound, crypto for inbound)
fee_amountCard fee charged on the transaction, e.g. the FX fee. Absent when zero; not folded into rate
rrnRetrieval reference number assigned by the card network
typeCardTransaction
directionOutbound (debit) or Inbound (credit)
operationsBalance movements of the transaction: the debit, and any refund or reversal credits
activity_stepsOrdered list of transaction stages

Operation Fields

FieldDescription
operation_idStable identifier of the operation. It stays the same in every webhook for that operation, so key your bookings on it
statusPending, Completed or Failed. It moves only forward; once Completed or Failed, the operation no longer changes
operation_reasonWhy the operation exists: Authorization, Clearing, Reversal, Refund, Representment, MoneySend, CreditAdjustment, DebitAdjustment, ChargebackRefund, ChargebackReversal
hashOn-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_amountToken amount moved, signed: negative for a debit, positive for a credit
transaction_amountThe same movement in the transaction currency, signed the same way
resulting_balanceToken balance after the operation. Reliable once the operation is Completed; while Pending it can read 0
rateRate 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:

Directionsource_amountdestination_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:

DirectionAmount SignExample
Outbound (debit)Negative-50.00
Inbound (credit)Positive50.00

This allows you to distinguish the transaction direction from the operation data alone without checking the direction field.

Transaction Status

StatusDescription
PendingTransaction in progress, until its debit settles
CompletedTransaction successful. A partially refunded purchase stays Completed
FailedTransaction declined, or refunded / reversed in full. There is no Cancelled status

Status Reasons

When status is Failed, status_reason indicates why:

ReasonDescription
InsufficientFundsUser balance too low
DailySpendAmountIsExceededCard spending limit exceeded
ChainRejectedThe on-chain debit was rejected
GeneralErrorProcessing error
BroadcastFailedThe 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 Reversal step
  • A new operation with positive operation_amount is added to the operations array
  • 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/CryptoIn steps 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_balance of a Completed operation, or its hash, to query the exact on-chain state

Did this page help you?