Payments - Cancel
Cancel a payment by its identifier.
Endpoint
POST /payments/{payment_id}/cancel
Example (cURL)
curl --request POST \
--url https://sandbox.hyperswitch.io/payments/{payment_id}/cancel \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"cancellation_reason": "requested_by_customer"
}
'Request
Authorization (header)
Name:
api-keyType: string
In: header
Required: yes
Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Do not expose this key on a website or embed it in a mobile application.
Path parameters
payment_id(string) — required The identifier for the payment.
Body (application/json)
cancellation_reason(string | null) The reason for the payment cancel.merchant_connector_details(object) Merchant connector details used to make payments. (Show child attributes)
Responses
200
Payment canceled
400 (example)
Links
Documentation: https://api-reference.hyperswitch.io/introduction
Locker API Reference: https://api-reference.hyperswitch.io/locker-api-reference/overview
Intelligent Router API Reference: https://api-reference.hyperswitch.io/intelligent-router-api-reference/overview
Edit docs: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/payments/payments--cancel.mdx
Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/payments/payments--cancel
Related:
Payments - Retrieve: https://api-reference.hyperswitch.io/v1/payments/payments--retrieve
Payments - Cancel Post Capture: https://api-reference.hyperswitch.io/v1/payments/payments--cancel-post-capture