Retrieve Withdraw
Retrieves the details of an existing withdraw by its UUID.
Don't have the UUID?
If you only stored your own referenceId (e.g., your invoice number) at create time, use
GET /withdraws/by-reference/:referenceId
instead.
Endpoint
GET /api/v1/withdraws/{withdraw_id}
Authentication
This endpoint requires HMAC Integration Authentication.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
withdraw_id | string | Yes | The UUID of the withdraw to retrieve |
Example Request
import crypto from 'crypto';
const API_KEY = process.env.PAYMENT_API_KEY!;
const API_SECRET = process.env.PAYMENT_API_SECRET!;
async function getWithdraw(withdrawId: string) {
const method = 'GET';
const path = `/api/v1/withdraws/${withdrawId}`;
const body = '';
const timestamp = Date.now().toString();
const message = `${timestamp}.${body}`;
const signature = crypto
.createHmac('sha256', API_SECRET)
.update(message)
.digest('hex');
const response = await fetch(`https://api.example.com${path}`, {
method,
headers: {
'X-API-Key': API_KEY,
'X-Timestamp': timestamp,
'X-Signature': `sha256=${signature}`,
},
});
const result = await response.json();
if (result.success) {
console.log('Withdraw status:', result.data.status);
console.log('Withdraw amount:', result.data.amount);
return result.data;
} else {
console.error('Error:', result.error);
throw new Error(result.error.message);
}
}
// Get withdraw
const withdraw = await getWithdraw('660e8400-e29b-41d4-a716-446655440001');Response
Success Response (200 OK)
{
"success": true,
"data": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"amount": "1000.00",
"currency": "THB",
"status": "paid",
"referenceId": "payout-12345",
"destinationType": "bank_account",
"bankAccountNumber": "1234****7890",
"bankAccountName": "John Doe",
"bankCode": "004",
"destinationId": null,
"description": "Payout for order #12345",
"metadata": {
"order_id": "12345"
},
"paidAt": "2024-01-01T00:05:00.000Z",
"canceledAt": null,
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:05:00.000Z"
}
}Error Response (404 Not Found)
{
"success": false,
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Withdraw not found"
}
}Withdraw Status
Withdraws can be in one of the following statuses:
| Status | Description |
|---|---|
pending | Withdraw created, waiting to be processed |
processing | Withdraw is being processed by provider |
paid | Withdraw completed successfully |
failed | Withdraw failed (e.g., insufficient balance) |
canceled | Withdraw was cancelled |
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Withdraw UUID |
amount | string | Amount as decimal string |
currency | string | Currency code (THB) |
status | string | Current withdraw status |
referenceId | string | Your reference ID |
destinationType | string | Destination type (bank_account or wallet) |
bankAccountNumber | string | Masked bank account number (or null) |
bankAccountName | string | Bank account name (or null) |
bankCode | string | Bank code (or null) |
destinationId | string | Destination ID (or null) |
description | string | Withdraw description (or null) |
metadata | object | Additional metadata (or null) |
paidAt | string | ISO timestamp when withdraw was paid (or null) |
canceledAt | string | ISO timestamp when withdraw was canceled (or null) |
createdAt | string | ISO timestamp when withdraw was created |
updatedAt | string | ISO timestamp when withdraw was last updated |