Skip to main content

Wallet to Account - Refunded Webhook

Overview

The walletToAccount.refunded webhook fires when a rejected or returned outbound payout has completed its return cycle and the principal amount is refunded back to the originating wallet.

  • Event Name: walletToAccount.refunded
  • Target State: refunded
  • 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 payment transaction ID.
amountstringReturned amount.
referencestringUnique tracking reference.
statestringLifecycle state ("refunded").
currencystringCurrency code.
typestringTransaction type ("wallet_to_account").
walletIdintegerWallet ID receiving the refunded funds.
createdDatestringTimestamp when originally requested.
completedDatestringTimestamp when refund settled into wallet.
accountobjectTarget account record that rejected payment.

Example Payload

{
"id": 10004,
"amount": "1000.00",
"reference": "REF-W2A-003",
"state": "refunded",
"currency": "USD",
"type": "wallet_to_account",
"walletId": 4001,
"createdDate": "2024-01-15T12:00:00Z",
"completedDate": "2024-01-15T12:05:00Z",
"account": {
"id": 502,
"accountNumber": "87654321",
"bankName": "HSBC",
"beneficiaryFirstName": "John",
"beneficiaryLastName": "Smith",
"beneficiaryEntityType": "individual",
"currency": "USD",
"status": "active"
}
}

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 walletToAccount.refunded
if (event.state === 'refunded') {
console.log(`Processing Wallet to Account - Refunded 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: