Refund Webhook
1. Background
After the partner submits a cashin refund request, the refund result may not be determinable within the synchronous request. Adopay notifies the partner of the refund result via an HTTP asynchronous callback once the refund is completed.
The same refund order may be notified multiple times due to retries. The partner should process notifications idempotently based on the primary merchant ID together with the merchant refund number refundSn, or on the platform refund ID refundId.
2. Callback Endpoint and Method
| Item | Value |
|---|---|
| Method | POST |
| URL | {cashinRefundNotificationUrl} |
| Content-Type | application/json |
| Purpose | Notify the cashin refund result |
{cashinRefundNotificationUrl} is the refund notification URL that the partner has configured and enabled. The callback URL must be a complete HTTP or HTTPS URL.
3. Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
Content-Type | string | Yes | Fixed to application/json. |
X-Merchant-Id | string | Yes | Primary merchant ID that receives the notification. |
X-Timestamp | string | Yes | Unix timestamp in seconds. |
X-Nonce | string | Yes | Random string for this request, used for anti-replay; regenerated on every retry. |
Digest | string | Yes | Digest of the raw request body, in the format SHA-256=<Base64(SHA256(body_bytes))>. |
Authorization | string | Yes | ES256 HTTP Signature information. |
Both Digest and Authorization are computed over the raw JSON bytes actually sent. When verifying the signature, the partner must not re-serialize the JSON first.
4. Request Body Fields
| Field | Type | Length | Returned | Description |
|---|---|---|---|---|
event | string | 32 | Yes | Notification event; see the refund events and statuses below. |
subMerchantNo | string | 64 | Yes | Partner-specific. Sub-merchant ID. |
attach | string | 128 | No | attach value the partner submitted when placing the original payment order; returned as-is if it was submitted, empty otherwise. |
mchOrderNo | string | 32 | Yes | Merchant order number of the original cashin order. |
platOrderNo | string | 64 | Yes | Platform order number of the original cashin order. |
orderStatus | string | 16 | Yes | Current status of the original cashin order. |
amount | decimal(25,2) | 25,2 | Yes | Original cashin order amount, i.e. the amount at order creation. |
payAmount | decimal(25,2) | 25,2 | Yes | Actual paid amount of the original cashin order. |
msg | string | 128 | Yes | Message; sucesso on success, the error message on failure. |
payTime | int | 19 | Yes | Payment completion time of the original cashin order, Unix timestamp in seconds. |
e2eId | string | 64 | Yes | Pix end-to-end transaction ID of the refund transaction; empty string while the channel has not returned it. |
payerName | string | 128 | Yes | Payer name of the original cashin order; empty string when unavailable. |
payerDocument | string | 14 | Yes | Payer tax ID of the original cashin order (CPF 11 digits / CNPJ 14 digits); empty string when unavailable. |
refundAmount | decimal(25,2) | 25,2 | Yes | Refund amount this time (principal, excluding fees); for multiple refunds, distinguish this time from the cumulative amount. |
refundId | string | 64 | Yes | Platform refund ID. |
originE2eId | string | 64 | Yes | Pix end-to-end transaction ID of the original cashin transaction, i.e. the payment being refunded. |
refund | decimal(25,2) | 25,2 | Yes | Cumulative principal refunded on the original cashin order as of the completion of this refund, excluding fees. |
refundSn | string | 64 | Yes | Merchant refund number, i.e. the refundSn submitted when the refund was initiated. |
status | string | 16 | Yes | Refund status: PENDING (in progress), SUCCESS (refund succeeded), FAILED (refund failed). |
currency | string | 3 | No | Refund currency, same as the original order currency, for example BRL. |
feeRefundAmount | decimal(25,2) | 25,2 | No | Fee refunded by this refund; 0 when no fee is refunded. |
fee | decimal(25,2) | 25,2 | No | Cumulative fee successfully refunded on the original cashin order as of the completion of this refund, excluding refund principal. |
refundTime | int | 19 | No | Refund time, Unix timestamp in seconds. |
Refund Events and Statuses
event | status | Meaning |
|---|---|---|
PIX_ | SUCCESS | PIX QR code cashin/acquiring — refund succeeded. |
PIX_ | FAILED | PIX QR code cashin/acquiring — refund failed. |
PIX_ | PENDING | Refund 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.
| Value | Meaning | Description |
|---|---|---|
PENDING | In progress | The order is being processed or is waiting for a result. |
SUCCESS | Succeeded | The order transaction completed successfully; if a refund occurs later, the order status changes to REFUND. |
FAILED | Failed | The order transaction failed. |
REFUND | Refunded | A 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:
- For a detailed description of each
orderStatusvalue and whether it is terminal, see theorderStatusenum of Query Payment by Order SN. orderStatus = REFUNDdoes not mean this refund succeeded. The result of this refund is determined only bystatus(PENDING/SUCCESS/FAILED); do not useorderStatusfor that.orderStatusdoes not reflect refund amounts. UserefundAmountfor this refund andrefundfor the cumulative refunded amount; to check whether the order has been fully refunded, compareTotal Amount refundwithTotal Amount payAmount.- State transition: the original cashin order can only move from
SUCCESStoREFUND; orders inPENDINGorFAILEDnever enterREFUND. An order can be partially refunded several times, and its status isREFUNDafter a partial refund as well.
5. Request Example
The following example shows a first successful refund on the original order: principal 50.00 and fee 0.30 refunded; accumulated refund principal 50.00; accumulated refunded fees 0.30.
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",
"subMerchantNo": "SUB00000001",
"attach": "order-source=checkout",
"mchOrderNo": "CASHIN202608160001",
"platOrderNo": "BAS202608160000000001",
"orderStatus": "REFUND",
"amount": 100.00,
"payAmount": 100.00,
"msg": "sucesso",
"payTime": 1786887025,
"e2eId": "D1234567820260816000000000000001",
"payerName": "Maria Oliveira",
"payerDocument": "12345678901",
"refundAmount": 50.00,
"refundTotalAmount": 50.00,
"refundId": "313",
"refundSn": "REFUND202608160001",
"originE2eId": "E1234567820260816000000000000001",
"status": "SUCCESS",
"currency": "BRL",
"feeRefundAmount": 0.30,
"feeRefundTotalAmount": 0.30,
"refundTime": 1786890000
}6. Partner Response Requirements
The partner 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/1.1 200 OK
Content-Type: text/plain
OK7. Notification Scenarios and Retries
When a cashin refund succeeds or fails, Adopay sends a callback notification to the partner.
After the first delivery attempt of a notification fails, Adopay retries at most 14 times, for at most 15 deliveries in total. Once the partner receives the notification successfully and returns the required success response, no further retries occur.
Whether to retry is determined jointly by the HTTP status code and the response body:
| HTTP Status Code | Response Body | Result |
|---|---|---|
200—299 | Exactly OK or SUCCESS after trimming leading and trailing whitespace | Notification delivered; no more retries |
200—299 | Empty body, JSON, other text, or wrong casing | Notification failed; retry continues |
Non-2xx | Any content | Notification failed; retry continues |
| No HTTP response received | Network timeout or connection failure | Notification failed; retry continues |
OK and SUCCESS are case-sensitive. For example, ok, Success, or {"status":"SUCCESS"} are not recognized as success responses. Although HTTP 204 is a 2xx status, its body is empty, so retries continue.
X-Timestamp, X-Nonce, Digest, and Authorization are regenerated for each delivery.
8. Integration Notes
- Use the primary merchant ID plus the merchant refund number (
refundSn), orrefundId, as an equivalent unique key; do not judge duplicates by the number of notifications received. - The partner should complete signature verification first, then validate the primary merchant ID, sub-merchant ID, original order number, refund number, currency, and amount, and update the refund result only after everything matches.
- Include
e2eId,originE2eId, and order numbers in audit records; where merchant, payer, or channel sensitive information is involved, logs should mask it or record only digests. - Return the required success response only after signature verification, idempotent processing, and data persistence all succeed, so the notification is not incorrectly acknowledged and lost to retries.