Cancel Payments
Learn how to cancel authorized payments and release reserved funds
Cancel Payments
Cancellation releases an authorization without collecting funds. Use this when you no longer need to complete a payment that has been authorized but not yet captured.
When to Cancel
Cancel a payment when:
- Customer changes their mind before you ship or fulfill
- Order cannot be fulfilled due to inventory or other issues
- Fraud detected during manual review
- Duplicate authorization was created by mistake
- Payment method changed by customer to a different option
API Endpoint
POST https://api.plexypay.com/v2/payments/{payment_id}/cancelsCancelling a Payment
Full Cancellation
Cancel the entire authorized amount:
curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/cancels \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"merchant_id": "merchant_abc123"
}'Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
merchant_id | string | Yes | Your merchant identifier |
reference | string | No | Your internal reference for this cancellation |
idempotency_key | string | No | Unique key to prevent duplicate cancellations |
Response
{
"payment_id": "pay_1234567890",
"cancel_id": "cnl_0987654321",
"status": "cancelled",
"merchant_id": "merchant_abc123",
"cancelled_at": "2026-03-25T10:30:00Z",
"original_amount": {
"value": 10000,
"currency": "KZT"
}
}Partial Cancellation
Some payment methods support partial cancellation, allowing you to reduce the authorized amount without fully cancelling.
Partial cancellation support varies by payment method and card scheme. Check
the capabilities.partial_cancel_allowed field on the payment object.
Checking Partial Cancel Support
Retrieve the payment to check whether partial cancellation is supported before submitting a partial cancel request:
curl -X GET https://api.plexypay.com/v2/payments/pay_1234567890 \
-H "x-api-key: YOUR_API_KEY"Check the capabilities.partial_cancel_allowed field in the response. If true, proceed with a partial cancellation request.
Partial Cancellation Request
curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/cancels \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"value": 3000,
"currency": "KZT"
},
"merchant_id": "merchant_abc123"
}'Partial Cancellation Response
{
"payment_id": "pay_1234567890",
"cancel_id": "cnl_0987654321",
"status": "partially_cancelled",
"merchant_id": "merchant_abc123",
"cancelled_at": "2026-03-25T10:30:00Z",
"cancelled_amount": {
"value": 3000,
"currency": "KZT"
},
"remaining_authorization": {
"value": 7000,
"currency": "KZT"
}
}Webhook Events
CANCEL
Sent when a cancellation is successfully processed.
{
"event_type": "CANCEL",
"event_id": "evt_abc123",
"created_at": "2026-03-25T10:30:00Z",
"data": {
"payment_id": "pay_1234567890",
"cancel_id": "cnl_0987654321",
"merchant_id": "merchant_abc123",
"status": "cancelled",
"cancelled_amount": {
"value": 10000,
"currency": "KZT"
},
"cancelled_at": "2026-03-25T10:30:00Z"
}
}CANCEL_FAILED
Sent when a cancellation attempt fails.
{
"event_type": "CANCEL_FAILED",
"event_id": "evt_def456",
"created_at": "2026-03-25T10:30:00Z",
"data": {
"payment_id": "pay_1234567890",
"merchant_id": "merchant_abc123",
"error": {
"code": "INVALID_PAYMENT_STATE",
"message": "Payment has already been captured and cannot be cancelled"
}
}
}Error Handling
| Error Code | Description | Resolution |
|---|---|---|
PAYMENT_NOT_FOUND | Payment ID does not exist | Verify the payment_id |
INVALID_PAYMENT_STATE | Payment not in authorized state | Use refund if captured |
AUTHORIZATION_EXPIRED | Authorization already expired | No action needed, funds already released |
PARTIAL_CANCEL_NOT_SUPPORTED | Payment method doesn't support partial cancel | Cancel full amount or proceed to capture |
AMOUNT_EXCEEDS_AUTHORIZATION | Cancel amount exceeds remaining authorization | Reduce the cancel amount |
Example Error Handling
If cancellation returns INVALID_PAYMENT_STATE, retrieve the payment to check its current status:
curl -X GET https://api.plexypay.com/v2/payments/pay_1234567890 \
-H "x-api-key: YOUR_API_KEY"If the payment status is captured, issue a refund instead:
curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/refunds \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"merchant_id": "merchant_abc123",
"reason": "CUSTOMER_REQUEST"
}'If the error is AUTHORIZATION_EXPIRED, no action is needed — the funds have already been released.
Cancel vs Other Modifications
| Scenario | Action |
|---|---|
| Payment authorized, not captured | Cancel |
| Payment captured, before settlement | Reversal |
| Payment captured, after settlement | Refund |
Best Practices
Don't leave unused authorizations open. Cancel as soon as you know you won't fulfill the order.
Prevent duplicate cancellations from retry attempts.
Sync your order management system when cancellation succeeds.
Inform customers that the hold on their funds has been released.
Listen for CANCEL and CANCEL_FAILED webhooks to ensure your systems stay in sync.
Automatic Cancellation
Authorizations that are not captured within their validity period are automatically cancelled by the card network. You'll receive a webhook notification:
{
"event_type": "AUTHORIZATION_EXPIRED",
"event_id": "evt_xyz789",
"created_at": "2026-03-25T10:30:00Z",
"data": {
"payment_id": "pay_1234567890",
"merchant_id": "merchant_abc123",
"expired_at": "2026-03-25T10:30:00Z",
"original_amount": {
"value": 10000,
"currency": "KZT"
}
}
}Even though expired authorizations are automatically released, it's best practice to explicitly cancel payments you don't intend to capture. This releases the hold on the customer's funds immediately rather than waiting for expiry.
Viewing Cancellations in Plexy Dashboard
View and manage cancellations in the Plexy Dashboard:
- Navigate to Payments
- Filter by Status: Cancelled
- Click on a payment to view cancellation details
The dashboard shows:
- Original authorization amount
- Cancellation timestamp
- Who initiated the cancellation (API, Dashboard, or automatic)
- Any partial cancellation history