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"
}
'{
"error_type": "invalid_request",
"message": "Missing required param: {param}",
"code": "IR_04"
}{
"error_type": "invalid_request",
"message": "Missing required param: {param}",
"code": "IR_04"
}Payments - Cancel
A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action.
Profile-restricted authentication can cancel only payments in that profile.
Payments outside the authenticated merchant/profile scope are treated as not found before cancellation side effects.
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"
}
'{
"error_type": "invalid_request",
"message": "Missing required param: {param}",
"code": "IR_04"
}{
"error_type": "invalid_request",
"message": "Missing required param: {param}",
"code": "IR_04"
}Authorizations
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. Don't expose this key on a website or embed it in a mobile application.
Headers
Merchant ID of the connected merchant on whose behalf the operation is performed. Required when authenticating with a platform merchant's API key. Standard and connected merchants must not send it.
Path Parameters
The identifier for payment
Body
The reason for the payment cancel
Merchant connector details used to make payments.
Show child attributes
Show child attributes
If enabled, provides whole connector response
Show child attributes
Show child attributes
Response
Payment canceled
Was this page helpful?