API Docs
Payments
API ReferencePaymentsCancel

Cancel Payment

Cancels a payment that has not been fully captured yet. Releases any authorized funds back to the customer's payment method. Once cancelled, the payment cannot be captured.

POST /payments/:payment_id/cancel

Path Parameters

ParameterTypeRequiredDescription
payment_idstringYesThe ID of the payment to cancel.

Body Parameters

ParameterTypeRequiredDescription
cancellation_reasonstringNoFree-text reason for the cancellation, useful for your own audit trail and customer support.

Request Example

curl -X POST 'https://api.v2.paychtec.com/payments/pay_1234567890abcdef/cancel' \  -H "Content-Type: application/json" \  -H "api-key: snd_YOUR_API_KEY" \  -d '{  "cancellation_reason": "Customer requested cancellation"}'

Response

{
  "payment_id": "pay_1234567890abcdef",
  "status": "cancelled",
  "amount": 6540,
  "currency": "USD",
  "cancellation_reason": "Customer requested cancellation",
  "cancelled_at": "2024-01-22T14:30:00Z"
}

Errors

StatusWhen
400Payment is in a state that cannot be cancelled (e.g. already fully captured or already cancelled).
404Payment id does not exist.