Skip to content

Cashin Refund Webhook ​

Asynchronous refund status notification.

Endpoint ​

POST /merchant-callback-url

Authentication ​

Merchant Credential. See Authentication.

1. Notification Background ​

After a merchant submits a cashin refund request, the refund result may not be determinable in the synchronous request. Adopay notifies the merchant of the refund result through an HTTP asynchronous callback once the refund is completed.

The same refund order may receive multiple notifications due to retries. The merchant should process notifications idempotently based on the merchant ID together with the merchant refund number refundSn, or on the platform refund ID refundId.

WARNING

Respond within 3 seconds; a response slower than 3 seconds is treated as a callback failure.

2. Callback URL and Request Method ​

Adopay sends a JSON notification with POST, with Content-Type set to application/json. The callback is sent to the refund notification URL that the merchant has configured and enabled. The URL must be a complete HTTP or HTTPS URL.

For signature verification and success response requirements, see Webhook Specification.

3. Request Header Fields ​

FieldTypeRequiredDescription
Content-TypestringYesFixed to application/json.
X-Merchant-IdstringYesMerchant ID receiving the notification.
X-TimestampstringYesUnix timestamp in seconds.
X-NoncestringYesRandom string of this request, used for anti-replay protection; regenerated for each retry.
DigeststringYesDigest of the raw request body. Format: SHA-256=<Base64(SHA256(body_bytes))>.
AuthorizationstringYesES256 HTTP Signature.

Digest and Authorization are both computed over the raw JSON bytes actually sent. When verifying the signature, the merchant must not re-serialize the JSON first.

4. Request Body Fields ​

FieldTypeLengthReturnedDescription
eventstring32YesNotification event; see the refund event and status table below.
mchOrderNostring32YesMerchant order number of the original cashin order.
platOrderNostring64YesPlatform order number of the original cashin order.
orderStatusstring16YesCurrent status of the original cashin order.
amountdecimal(25,2)25,2YesOriginal cashin order amount, i.e. the amount at order creation.
payAmountdecimal(25,2)25,2YesActual paid amount of the original cashin order.
msgstring128YesMessage; sucesso on success, the error message on failure.
payTimeint19YesPayment completion time of the original cashin order, Unix timestamp in seconds.
e2eIdstring64YesPix end-to-end transaction ID of the refund transaction; empty string while the channel has not returned it.
payerNamestring128YesPayer name of the original cashin order; empty string when unavailable.
payerDocumentstring14YesPayer tax ID of the original cashin order (CPF 11 digits / CNPJ 14 digits); empty string when unavailable.
refundAmountdecimal(25,2)25,2YesRefund amount this time (principal, excluding fees); for multiple refunds, distinguish this time from the cumulative amount.
refundIdstring64YesPlatform refund ID.
originE2eIdstring64YesPix end-to-end transaction ID of the original cashin transaction, i.e. the payment being refunded.
refundTotalAmountdecimal(25,2)25,2YesCumulative principal refunded on the original cashin order as of the completion of this refund, excluding fees.
refundSnstring64YesMerchant refund number, i.e. the refundSn submitted when the refund was initiated.
statusstring16YesRefund status: PENDING (in progress), SUCCESS (refund succeeded), FAILED (refund failed).
attachstring128NoThe attach value passed by the merchant when the original cashin order was created; returned as-is if provided at order creation, empty otherwise.
currencystring3NoRefund currency, same as the original order currency, for example BRL.
feeRefundAmountdecimal(25,2)25,2NoFee refunded by this refund; 0 when no fee is refunded.
feeRefundTotalAmountdecimal(25,2)25,2NoCumulative fee successfully refunded on the original cashin order as of the completion of this refund, excluding refund principal.
refundTimeint19NoRefund time, Unix timestamp in seconds.

Refund Event and Status Mapping ​

eventstatusMeaning
PIX_QRCODE_REFUNDSUCCESSPix QR code cashin / acquiring — refund succeeded.
PIX_QRCODE_REFUNDFAILEDPix QR code cashin / acquiring — refund failed.
PIX_QRCODE_REFUNDPENDINGRefund in progress.

orderStatus Order Status ​

orderStatus is the status of the original cashin order, not the status of the refund: use status to determine whether this refund succeeded, and event to identify the notification type.

ValueMeaningDescription
PENDINGIn progressThe order is being processed or is waiting for a result.
SUCCESSSucceededThe order transaction completed successfully; if a refund occurs later, the order status changes to REFUND.
FAILEDFailedThe order transaction failed.
REFUNDRefundedA refund has occurred on the order (the amount has been partly or fully returned). It can only be reached from SUCCESS, and it does not mean the order has been fully refunded.

Usage notes:

  1. For a detailed description of each orderStatus value and whether it is terminal, see the orderStatus enum of Query Payment by Order SN.
  2. orderStatus = REFUND does not mean this refund succeeded. The result of this refund is determined only by status (PENDING / SUCCESS / FAILED); do not use orderStatus for that.
  3. orderStatus does not reflect refund amounts. Use refundAmount for this refund and refundTotalAmount for the cumulative refunded amount; to check whether the order has been fully refunded, compare refundTotalAmount with payAmount.
  4. State transition: the original cashin order can only move from SUCCESS to REFUND; orders in PENDING or FAILED never enter REFUND. An order can be partially refunded several times, and its status is REFUND after a partial refund as well.

5. Request Example ​

The following example is a first successful refund on the original order: principal 50.00 and fee 0.30 refunded; cumulative refunded principal is 50.00 and cumulative refunded fee is 0.30.

http
POST /notify/adopay/cashin/refund HTTP/1.1
Host: merchant.example.com
Content-Type: application/json
X-Merchant-Id: 92315566000120
X-Timestamp: 1786838460
X-Nonce: 4de901987ca14b25acf2639056ac6002
Digest: SHA-256=<REQUEST_BODY_SHA256_BASE64>
Authorization: Signature keyId="v1",alg="ES256",headers="(request-target) x-timestamp x-nonce digest",signature="<ES256_SIGNATURE_BASE64>"

{
  "event": "PIX_QRCODE_REFUND",
  "attach": "order-source=checkout",
  "mchOrderNo": "CASHIN202608160001",
  "platOrderNo": "BAS202608160000000001",
  "orderStatus": "REFUND",
  "amount": 100,
  "payAmount": 100,
  "msg": "sucesso",
  "payTime": 1786887025,
  "e2eId": "D1234567820260816000000000000001",
  "payerName": "Maria Oliveira",
  "payerDocument": "12345678901",
  "refundAmount": 50,
  "refundTotalAmount": 50,
  "refundId": "313",
  "refundSn": "REFUND202608160001",
  "originE2eId": "E1234567820260816000000000000001",
  "status": "SUCCESS",
  "currency": "BRL",
  "feeRefundAmount": 0.3,
  "feeRefundTotalAmount": 0.30,
  "refundTime": 1786890000
}

6. Merchant Response Requirements ​

The merchant must finish signature verification, idempotent processing, and persistence of the business data within 3 seconds, and return HTTP 200—299 with a plain-text body of OK (SUCCESS is also accepted):

http
HTTP/1.1 200 OK
Content-Type: text/plain

OK

7. Notification Scenarios and Retry Counts ​

Adopay sends a callback notification to the merchant when a cashin refund succeeds or fails.

After the first send of each notification fails, Adopay retries up to 14 times, for a maximum of 15 sends in total. Once the merchant has received it and returned the required success response, no more retries are made.

Whether to retry is determined jointly by the HTTP status code and the response body:

HTTP Status CodeResponse BodyResult
200—299Exactly OK or SUCCESS after trimming leading and trailing whitespaceNotification succeeded; no more retries
200—299Empty body, JSON, other text, or casing other than the required oneNotification failed; retries continue
Not 2xxAny contentNotification failed; retries continue
No HTTP response receivedNetwork timeout or connection failureNotification failed; retries continue

OK and SUCCESS are case-sensitive. For example, ok, Success, or {"status":"SUCCESS"} are not recognized as success responses. HTTP 204 is a 2xx code, but its body is empty, so retries still continue.

X-Timestamp, X-Nonce, Digest, and Authorization are regenerated for each send.

8. Integration Notes ​

  1. Use the merchant ID plus the merchant refund number (refundSn), or refundId, as an equivalent unique key; do not judge duplicates by the number of notifications received.
  2. The merchant should verify the signature first, then check the merchant ID, original order numbers, refund number, currency, and amounts; only update the refund result when all of them match.
  3. e2eId, originE2eId, and order numbers should be included in audit records; when sensitive merchant, payer, or channel information is involved, mask it in logs or record only a digest.
  4. Return the required success response only after signature verification, idempotent processing, and persistence of the business data have all succeeded, so that a notification wrongly acknowledged cannot be retried.