Skip to main content
POST
/
api
/
withdrawals
/
:id
/
cancel
curl -X POST https://api.swiftpay.cx/api/withdrawals/wd_abc123/cancel \
  -H "Authorization: Bearer mp_live_your_api_key"
const withdrawalId = "wd_abc123";

const response = await fetch(
   `https://api.swiftpay.cx/api/withdrawals/${withdrawalId}/cancel`,
   {
      method: "POST",
      headers: {
         Authorization: "Bearer mp_live_your_api_key",
      },
   }
);

const result = await response.json();

if (result.success) {
   console.log("Withdrawal cancelled, funds returned to balance");
}
import requests

withdrawal_id = 'wd_abc123'

response = requests.post(
    f'https://api.swiftpay.cx/api/withdrawals/{withdrawal_id}/cancel',
    headers={'Authorization': 'Bearer mp_live_your_api_key'}
)

result = response.json()
if result['success']:
    print('Withdrawal cancelled')
{
  "success": true,
  "data": {
    "id": "wd_abc123",
    "status": "cancelled",
    "amountInCents": 50000
  }
}
{
   "success": false,
   "error": {
      "type": "validation_error",
      "message": "Cannot cancel withdrawal in processing status",
      "requestId": "req_abc123"
   }
}
{
   "success": false,
   "error": {
      "type": "not_found",
      "message": "Withdrawal not found",
      "requestId": "req_abc123"
   }
}

Cancel Withdrawal

Cancels a pending withdrawal request. Only withdrawals with status pending can be cancelled.
Withdrawals in processing status cannot be cancelled.

Request

Authorization
string
required
Bearer token with your API key
id
string
required
The unique identifier of the withdrawal to cancel

Response

success
boolean
Whether the request was successful
data
object
curl -X POST https://api.swiftpay.cx/api/withdrawals/wd_abc123/cancel \
  -H "Authorization: Bearer mp_live_your_api_key"
const withdrawalId = "wd_abc123";

const response = await fetch(
   `https://api.swiftpay.cx/api/withdrawals/${withdrawalId}/cancel`,
   {
      method: "POST",
      headers: {
         Authorization: "Bearer mp_live_your_api_key",
      },
   }
);

const result = await response.json();

if (result.success) {
   console.log("Withdrawal cancelled, funds returned to balance");
}
import requests

withdrawal_id = 'wd_abc123'

response = requests.post(
    f'https://api.swiftpay.cx/api/withdrawals/{withdrawal_id}/cancel',
    headers={'Authorization': 'Bearer mp_live_your_api_key'}
)

result = response.json()
if result['success']:
    print('Withdrawal cancelled')
{
  "success": true,
  "data": {
    "id": "wd_abc123",
    "status": "cancelled",
    "amountInCents": 50000
  }
}
{
   "success": false,
   "error": {
      "type": "validation_error",
      "message": "Cannot cancel withdrawal in processing status",
      "requestId": "req_abc123"
   }
}
{
   "success": false,
   "error": {
      "type": "not_found",
      "message": "Withdrawal not found",
      "requestId": "req_abc123"
   }
}

Cancellation Rules

Current StatusCan Cancel?
pending✅ Yes
processing❌ No
completed❌ No
failed❌ No
cancelled❌ No
When a withdrawal is cancelled, the funds are immediately returned to your available balance.