Cancel Payment

Cancels a payment that was not yet approved.


Request body


Name Type Mandatory Description
paymentId string Yes VTEX payment ID from this payment
requestId string Yes The unique identifier for this request to ensure its idempotency
authorizationId string Yes Payment authorization identifier (in case it was authorized previous to the cancellation request)
sandboxMode string Indicates whether or not this request is being sent from a sandbox environment

Response body


Name Type Mandatory Description
paymentId string Yes The same paymentId sent in the request
status string This field is deprecated, please don't send it
message string Provider's operation/error message to be logged
code string Provider's operation/error code to be logged (return cancel-manually if you do not support this operation, so we can send a notification to the merchant)
cancellationId string Yes Provider's cancellation identifier (if the operation has failed you MUST return null)
requestId string Yes The same requestId sent in the request

Request examples and their responses

curl --location --request POST 'https://{{providerBaseUrl}}/payments/{{paymentId}}/cancellations' \
--header 'X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}' \
--header 'X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
    "paymentId": "B2F246B3CE46469FBDD23039868E95D0",
    "requestId": "007B7D9B3BB4440982D8B6BA04126B01",
    "authorizationId": "AUT-70D2444272"
}'
curl --location --request POST 'https://{{providerApiEndpoint}}/payments/{{paymentId}}/cancellations' \
--header 'X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}' \
--header 'X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
    "paymentId": "F5C1A4E20D3B4E07B7E871F5B5BC9F91",
    "requestId": "D12D9B80972C462980F5067A3A126837"
}'
curl --location --request POST 'https://{providerBaseUrl}/payments/{paymentId}/cancellations' \
--header 'X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}' \
--header 'X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
    "paymentId": "F5C1A4E20D3B4E07B7E871F5B5BC9F91",
    "requestId": "D12D9B80972C462980F5067A3A126837"
}'
{
    "paymentId": "B2F246B3CE46469FBDD23039868E95D0",
    "message": "Cancellation should be done manually",
    "code": "cancel-manually",
    "cancellationId": null,
    "requestId": "007B7D9B3BB4440982D8B6BA04126B01"
}
{
    "paymentId": "B2F246B3CE46469FBDD23039868E95D0",
    "message": null,
    "code": null,
    "cancellationId": "36153ED9F4FB4F109BE67CD05EE54373",
    "requestId": "007B7D9B3BB4440982D8B6BA04126B01"
}
Language
Authentication
URL
Click Try It! to start a request and see the response here!