Cancel service

After obtaining a cancel NIT in the previous step, the merchant will be able to reverse the desired payment.

After a successful cancellation, the payment transaction will change its status to EST (reversed). Depending on the acquirer, it may be possible to do partial reversals, which means cancelling a smaller amount than what was paid. In this case, the payment transaction will keep the CON status.

Call details#

  • Resource: /v1/cancellations/{nit}
  • HTTP Method: PUT
  • Request format: JSON
  • Response format: JSON
  • Header parameters:
ParameterDescriptionFormatMandatory
merchant_idMerchant code on Carat Portal. The production and certification codes will be different.< 15 ANYES
merchant_keyMerchant authentication key on Carat Portal. The production and certification keys will be different.< 80 ANYES
Content-TypeIt must be sent with the value application/json.= 15 ANYES

Examples#

Below are some examples of cancel service calls using the cURL tool.

Cancelling a payment via SiTef#

Request:

To use this example, don't forget to define the variable {{url}} with the value
esitef-homologacao.softwareexpress.com.br

curl
--request PUT "https://{{url}}/e-sitef/api/v1/cancellations/1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr**"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--data-binary
{
"card":{
"security_code":"123",
"number":"5555555555555555",
"expiry_date":"1222"
},
"amount":"1000"
}
--verbose

Response:

{
"code":"0",
"message":"OK. Transaction successful.",
"cancellation":{
"authorizer_code":"000",
"authorizer_message":"Transacao OK",
"status":"CON",
"nit":" 1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr",
"order_id":"09062259711",
"customer_receipt":"=== COMPROVANTE ===",
"merchant_receipt":"=== COMPROVANTE ===",
"authorizer_id":"2",
"acquirer_id":"229",
"acquirer_name":"Bin",
"authorizer_date":"09/11/2017T18:23",
"authorization_number":"092423",
"merchant_usn":"9062259711",
"esitef_usn":"171109108051261",
"sitef_usn":"092424",
"host_usn":"999092424 ",
"amount":"1000",
"payment_type":"C",
"issuer":"2",
"authorizer_merchant_id":"000000000000005",
"esitef_date":"09/11/2017T18:23",
"is_host_cancel":"false"
}
}

Cancelling a payment via BIN#

Request:

To use this example, don't forget to define the variable {{url}} with the value
esitef-homologacao.softwareexpress.com.br

curl
--request PUT "https://{{url}}/e-sitef/api/v1/cancellations/1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--data-binary
{}
--verbose

Response:

{
"code":"0",
"message":"OK. Transaction successful.",
"cancellation":{
"authorizer_code":"0",
"authorizer_message":"Operation Successful",
"status":"CON",
"nit":"1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr",
"order_id":"10022938077",
"customer_receipt":"=== COMPROVANTE ===",
"merchant_receipt":"=== COMPROVANTE ===",
"authorizer_id":"2",
"acquirer_id":"229",
"acquirer_name":"BIN",
"merchant_usn":"10022938091",
"esitef_usn":"171110108163221",
"amount":"1000",
"payment_type":"C",
"authorizer_merchant_id":"zzzzzzzzzzzzzzzzzz",
"esitef_date":"10/11/2017T14:29",
"is_host_cancel":"false"
}
}

Cancel via host#

Request:

To use this example, don't forget to define the variable {{url}} with the value
esitef-homologacao.softwareexpress.com.br

curl
--request PUT "https://{{url}}/e-sitef/api/v1/cancellations/1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--data-binary
{
"card":{
"expiry_date":"1222",
"number":"455182001234512345"
},
"amount":"2000",
"acquirer":{
"host_usn":"123123123",
"sitef_usn":"123123",
"authorizer_date":"090917",
"authorizer_id":"1",
"tef_product_code":"0001",
"tef_flow_code":"01",
"authorization_number":"123456"
}
}
--verbose

Response:

{
"code":"0",
"message":"OK. Transaction successful.",
"cancellation":{
"authorizer_code":"000",
"authorizer_message":"Transacao OK!",
"status":"CON",
"nit":"1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr",
"customer_receipt":"=== COMPROVANTE ===",
"merchant_receipt":"=== COMPROVANTE ===",
"authorizer_id":"1",
"acquirer_id":"229",
"acquirer_name":"Bin",
"authorizer_date":"09/11/2017T18:42",
"authorization_number":"092425",
"esitef_usn":"171109108051271",
"sitef_usn":"092425",
"host_usn":"000092425 ",
"amount":"2000",
"payment_type":"C",
"authorizer_merchant_id":"020001355570001",
"esitef_date":"09/11/2017T18:42",
"is_host_cancel":"true"
}
}

Response codes

See reference on API codes - response codes

Cancel external origin#

Request:

To use this example, don't forget to define the variable {{url}} with the value
esitef-homologacao.softwareexpress.com.br

curl
--request PUT "https://{{url}}/e-sitef/api/v1/cancellations/1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr"
--header "Content-Type: application/json"
--header "merchant_id: xxxxxxxxxxx"
--header "merchant_key: xxxxxxxxxxx"
--data-binary
{
"card":{
"expiry_date":"1222",
"number":"455182001234512345"
},
"amount":"2000",
"acquirer":{
"host_usn":"123123123",
"sitef_usn":"123123",
"authorizer_date":"090917",
"authorizer_id":"2",
"authorization_number":"123456"
}
}
--verbose

Response:

{
"code":"0",
"message":"OK. Transaction successful.",
"cancellation":{
"authorizer_code":"000",
"authorizer_message":"Transacao OK!",
"status":"CON",
"nit":"1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr",
"customer_receipt":"=== COMPROVANTE ===",
"merchant_receipt":"=== COMPROVANTE ===",
"authorizer_id":"2",
"acquirer_id":"299",
"acquirer_name":"Bin",
"authorizer_date":"09/11/2017T18:42",
"authorization_number":"092425",
"esitef_usn":"171109108051271",
"sitef_usn":"092425",
"host_usn":"000092425 ",
"amount":"2000",
"payment_type":"C",
"authorizer_merchant_id":"020001355570001",
"esitef_date":"09/11/2017T18:42"
}
}

Request parameters#

The table below describes the request parameters of the cancel service:

ParameterDescriptionFormatMandatory
amountAmount in cents to be cancelled. It’s important to note that not every acquirer supports cancellations with an amount smaller than the payment amount (partial reversal).
If this field is not sent, Carat Portal will assume the total amount of the payment.
< 12 NNO
soft_descriptorAdditional text that will be presented alongside the name of the establishment in the credit card invoice. Learn more< 30 ANNO
card
numberCustomer card number (PAN). Mandatory when cancelling payments via SiTef.< 19 NCOND.
expiry_dateCard expiry date in MMYY format. Its requirement depends on the selected acquirer.= 4 NCOND.
security_codeSecurity code. It’s mandatory depending on the contract signed with the acquirer.< 5 NCOND.
tokenHASH of a card stored on Carat Portal. It’s not allowed to send an ‘open’ card number (number field) and a stored card (token field) on the same request.= 88 ANNO
wallet_transaction_idDigital wallet transaction ID. Currently, this functionality is only available to the Visa Checkout and VEE (via CardSE via SiTef) authorizer.
It isn’t allowed to send an "open" card number (number field), a stored card (token field) and a wallet_transaction_id on the same request.
< 25 ANNO
acquirerThe fields of this element should only be sent in cases of cancel via host, cancel external origin or cancel PayPal transactions.
routing_idRouting information used by the payment done outside of e-SiTef. It is used to identify the routing inside of SiTef. This information only make sense in external origin transaction.< 5 NNO
host_usnHost/authorizer USN of the transaction to be cancelled. Mandatory for cancel via host and cancel external source.= 20 NCOND.
sitef_usnSiTef USN of the transaction to be cancelled. Mandatory for cancel via host and cancel external source.= 6 NCOND.
authorizer_datePayment authorization date returned by the authorizer in DD/MM/YYYY format. Mandatory for cancel via host and cancel external source.= 10 DCOND.
authorizer_idCode of the authorizer on Carat Portal. It must be the same value sent on the payment. Mandatory for cancel via host and cancel external source.< 3 NCOND.
tef_product_codeTEF product code obtained on the payment. This field can receive the following values:
0001 - Visa
0080 - Mastercard
These values can be altered by Cielo without previous warning. Mandatory for cancel via host and cancel external source via Cielo routing.
< 4 NCOND.
tef_flow_codeTEF flow code obtained on the payment. Currently, this field can only receive the value 01 (credit flow). Mandatory for cancel via host and cancel external source via Cielo routing. < 2 NCOND.
authorization_numberAuthorization number of the transaction to be cancelled. Mandatory for cancel via host and cancel external source.< 60 NCOND.
product_codeProduct code.
It is mandatory in routing via Marisa.
< 6 NCOND.
refund_typeType of cancellation you want to make about payment.
It is mandatory and only used for routing via Paypal.

Allowed values:

Full - Full payment chargeback is desired.

Partial - Partial payment chargeback is desired
< 7 ANCOND.
currency_codeCurrency code to be used in chargeback according to ISO 4217. For Real, the code used is BRL.
It is mandatory and only used for routing via Paypal.
< 3 ANCOND.
invoice_idMerchant's own chargeback order code for future reference or tracking.
Used for Paypal routing only.
< 127 ANNO
notePersonalized message for chargeback reminders.
Used for Paypal routing only
< 256 ANNO
retry_untilData and timeout until a chargeback attempt is made. Format: AAAA-MM-DDTHH:MM:SS.
Used for Paypal routing only.
< 20 ANNO
refund_sourceMerchant funds source that will be used to perform the chargeback.
Used for Paypal routing only.

Allowed values:

any - The merchant has no preference. Any available source of funds will be used.

default - The funds source set up in the merchant's account will be used.

instant - Merchant's balance will be used as a source of funds.

eCheck - The “eCheck” option will be used as a source of funds. If the retailer's balance can cover the chargeback, the balance sheet will be used.
< 7 ANNO
merchant_store_detailsMerchant's establishment information.
Used for Paypal routing only.
< 50 ANNO
refund_adviceIndicator for customer who has already received a chargeback of the given transaction.
Used for Paypal routing only.
< 5 ANNO
refund_item_detailsDetails of individual item handled on chargeback.
Used for Paypal routing only.
NO
msg_sub_idThis ID will uniquely identify the message and can be used to request the latest results from a previous request without the need to create a new request. This can be done, for example, on calls that have been timeout canceled or errors during the process.
Used for Paypal routing only.
< 38 ANNO
terminal_idUsed if it is a Point of Sale. Used for Paypal routing only.< 50 ANNO
store_idUsed if it is a Point of Sale. Used for Paypal routing only.< 50 ANNO
terminalSitef terminal code. In absence Carat Portal will generate a random terminal code.= 14 NNO
company_codeSitef company code. In absence Carat Portal will use company code from merchant configuration.= 8 NNO
acquirer.submerchant_split[]It consists of an array for split payments, unique to BIN and Sipag routing, both via SiTef. It allows the division of parts of the total amount of the payment among other merchants. The maximum number of items allowed in this array is 5 items.
submerchant_codeBIN/Sipag merchant code< 51 ANNO
submerchant_amoutTransaction amount related to the merchant< 12 NNO
ecomm_pos_refThis field will send and identification that will appear in the PDV field of the SiTef Web report for e-commerce transactions.< 8 AFNO

WARNING: The terminal e company_code parameters must be used only in Cancel external origin. In this case, they must be sent simultaneously. It is also necessary send a request to the Carat Portal Support Team for the permission Allows the sending of Company and SiTef Terminal through REST.

Response parameters#

If successful, the HTTP response code will be 200. Any other code must be interpreted as an error. The table below describes the response parameters of the cancel service:

ParameterDescriptionFormat
codeCarat Portal response code. Any code different from 0(zero) means failure. Learn more.< 4 N
messageCarat Portal response message.< 500 AN
cancellation
authorizer_codeAuthorizer response code.< 10 AN
authorizer_messageAuthorizer response message.< 500 AN
statusStatus of the payment transaction on Carat Portal. Learn more.= 3 AN
nitIdentifier of the cancel transaction on Carat Portal.= 64 AN
order_idOrder code of the transaction sent by the merchant.< 40 AN
merchant_usnUnique sequential number of the transaction sent by the merchant.< 12 N
amountAmount of the cancel transaction as specified by the merchant (in cents).< 12 N
sitef_usnUnique sequential number of the cancel transaction on SiTef.= 6 N
esitef_usnUnique sequential number of the cancel transaction on Carat Portal.= 15 N
customer_receiptCustomer’s receipt.< 4000 AN
merchant_receiptMerchant’s receipt.< 4000 AN
authorizer_idCode of the authorizer used on the transaction.< 4 N
acquirer_idCode of the acquirer used on the transaction.< 4 N
acquirer_nameName of the acquirer used on the transaction.< 100 AN
authorizer_dateCancel authorization date returned by the authorizer in DD/MM/YYYY'T'HH:mm format. Example: 13/07/2017T16:03= 16 D
authorization_numberAuthorization number.< 6 AN
host_usnHost USN.< 20 AN
tidID of the transaction on the acquirer. This field is only returned on transactions with acquirers that are external to SiTef.< 40 AN
esitef_dateCancel authorization date on Carat Portal in DD/MM/YYYY'T'HH:mm format. Example: 13/07/2017T16:03= 16 D
issuerIssuer code returned by the authorizer.< 5 AN
authorizer_merchant_idAffiliation code of the merchant on the authorizer.< 100 AN
is_host_cancelThis field will return the value true in case of cancel via host.< 5 T/F