Skip to main content

Wallet to Wallet - Completed Webhook

Overview

The walletToWallet.completed webhook fires when funds move between two wallets. Two separate webhook notifications are emitted: one for the debited source wallet (transactionType: "debit") and one for the credited target wallet (transactionType: "credit").

  • Event Name: walletToWallet.completed
  • Target State: completed
  • HTTP Method: POST (Sent from Atlas to your configured webhook listener URL)

Webhook Headers

HeaderDescription
Content-Typeapplication/json
X-Atlas-SignatureHMAC SHA-256 signature and timestamp for message authentication
X-Atlas-Delivery-IdUnique UUID tracking this webhook delivery attempt

Payload Schema

Payload Fields

FieldTypeDescription
idintegerUnique transaction record ID.
amountnumberNumerical amount transferred (e.g. 250).
referencestringInternal transfer reference (e.g. "REF-W2W-002").
statestringCurrent state ("completed").
currencystringISO currency code (e.g. "GBP").
typestringTransaction type ("wallet_to_wallet").
walletIdintegerCurrent wallet context for this event notification.
transactionTypestringLeg of the transfer: "credit" or "debit".
toWalletIdintegerDestination wallet ID.
fromWalletIdintegerSource wallet ID.
createdDatestringTimestamp when transfer was initiated.
completedDatestringTimestamp when transfer completed.
companyIdintegerCompany ID owning the wallet.
clientReferencestringCustom client reference if supplied.
externalUniqueRefstringExternal idempotency reference if provided.

Example Payload

{
"id": 10002,
"amount": 250,
"reference": "REF-W2W-002",
"state": "completed",
"currency": "GBP",
"type": "wallet_to_wallet",
"walletId": 3001,
"transactionType": "credit",
"toWalletId": 3001,
"fromWalletId": 3002,
"createdDate": "2024-01-15T11:00:00Z",
"completedDate": "2024-01-15T11:00:05Z",
"companyId": 456
}

Expected Response

Your endpoint must respond with an HTTP 200 OK status code within 5 seconds to acknowledge delivery:

HTTP/1.1 200 OK
Content-Type: application/json

{
"status": "received"
}

Handling Example

// Express.js Webhook Handler
app.post('/api/webhooks/atlas', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-atlas-signature'];

try {
// 1. Verify webhook signature
verifySignature(req.body, signature, process.env.ATLAS_WEBHOOK_SECRET);

const event = JSON.parse(req.body.toString());

// 2. Handle walletToWallet.completed
if (event.state === 'completed') {
console.log(`Processing Wallet to Wallet - Completed Webhook: Reference ${event.reference}, Amount: ${event.amount} ${event.currency}`);
// Update your internal order or ledger state
}

// 3. Acknowledge receipt
res.status(200).json({ status: 'received' });
} catch (err) {
console.error('Webhook verification failed:', err.message);
res.status(400).send('Invalid signature');
}
});

Interactive Payload Schema & Example

Review the full JSON schema and test response handling: