Skip to main content

Canceling a transaction

About transaction cancellation#

Cancellation is only possible for transactions in authorized state (authorized and awaiting capture). Already captured transactions cannot be canceled — in that case, use refund.

Cancellation immediately releases the reservation in the customer's wallet, preventing any subsequent charge.

info

The deadline to cancel an authorized transaction is up to 6 days from the authorization date. After this period, the transaction automatically moves to EXPIRED.

Endpoint#

POST https://ecommerce-api.svc.picpay.com/v1/payments/cancel

Request example#

curl --location --request POST 'https://ecommerce-api.svc.picpay.com/v1/payments/cancel' \
--header 'Authorization: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data '{
"transaction_id": "57e8b5af-d42b-42a4-9d5e-181aacf1ee9e",
"reference_id": "61b19b5c-0cd2-4cb9-931a-c797bb8b9222"
}'

Body parameters#

FieldTypeRequiredDescription
transaction_idstringYes*Transaction identifier generated by PicPay at the time of the charge
reference_idstringYes*Unique transaction identifier generated by the partner

*At least one of the two identifiers must be provided. When both are sent, both will be validated.

Response example#

{
"transaction_id": "57e8b5af-d42b-42a4-9d5e-181aacf1ee9e",
"reference_id": "61b19b5c-0cd2-4cb9-931a-c797bb8b9222",
"created_at": "2020-04-16 20:59:58"
}

The transaction moves from AUTHORIZED to CANCELLED.

Possible errors#

business_codeHTTPDescription
TRANSACTION_CANT_BE_CANCELLED409Current status does not allow cancellation
TRANSACTION_NOT_FOUND404Transaction not found

Next steps#