Cashin Webhook
Asynchronous payment status notification.
Endpoint
POST/merchant-callback-urlAuthentication
Merchant Credential. See Authentication.
1. Notification Background
After a merchant initiates a cashin transaction, the final result may not be determinable in the synchronous request. When the cashin succeeds, Adopay notifies the merchant of the result through an HTTP asynchronous callback.
The merchant should process notifications idempotently based on platOrderNo or mchOrderNo. The same order may receive multiple notifications due to retries.
WARNING
Always verify payAmount (the actual paid amount). 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 to the cashin callback URL provided by the merchant, with Content-Type set to application/json. The callback URL must be a complete HTTP or HTTPS URL. For signature verification and success response requirements, see Webhook Specification.
3. Request Header Fields
| Field | Type | Length | Required | Description |
|---|---|---|---|---|
Content-Type | string | 16 | Yes | Fixed to application/json. |
X-Merchant-Id | string | 64 | Yes | Merchant ID receiving the notification. |
X-Timestamp | string | 19 | Yes | Unix timestamp in seconds. |
X-Nonce | string | 64 | Yes | Random string of this request, used for anti-replay protection. |
Digest | string | 52 | Yes | Digest of the raw request body. Format: SHA-256=<Base64(SHA256(body_bytes))>. |
Authorization | string | Variable | Yes | ES256 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
Business status: status is an integer; status = 200 indicates business success, in which case msg = "sucesso". Any value other than 200 indicates a business error; see msg for the reason.
| Field | Type | Length | Returned | Description |
|---|---|---|---|---|
event | string | 64 | Yes | Notification event; see the event enum below. |
mchOrderNo | string | 32 | Yes | Merchant order number, i.e. the mchOrderNo passed by the merchant at order creation. |
platOrderNo | string | 64 | Yes | Adopay cashin platform order number. |
orderStatus | string | 16 | Yes | Order status, one of PENDING (processing), SUCCESS (cashin succeeded), FAILED (cashin failed), REFUND (refunded; reached only from SUCCESS, and it only means a refund has occurred, not necessarily a full refund); SUCCESS in a cashin success notification. |
amount | decimal | 25,2 | Yes | Order amount, i.e. the amount at order creation; the merchant should verify this field. |
payAmount | decimal | 25,2 | Yes | Actual paid amount; the merchant must verify it. |
fee | decimal | 25,2 | Yes | Fee. |
status | int | - | No | Response code |
msg | string | 128 | Yes | Message; sucesso when normal, the error message on a business error. |
payTime | int | 19 | Yes | Payment completion time, Unix timestamp in seconds; 0 when unavailable. |
e2eId | string | 64 | Yes | Bank E2E transaction number (bank transaction reference number), returned when the order succeeds or is refunded; may be empty when not generated. |
payerName | string | 128 | No | Payer name; returned when the order succeeds. |
payerDocument | string | 14 | No | Payer tax ID: CPF is 11 digits, CNPJ is 14 digits; returned when the order succeeds. |
attach | string | 128 | No | The attach value passed by the merchant when the original cashin order was created; returned as-is if provided at order creation, empty otherwise. |
Event and Status Mapping
event | orderStatus | Meaning |
|---|---|---|
PIX_QRCODE_PAID | SUCCESS | Pix QR code cashin / acquiring — cashin succeeded. |
REFUND status notes
- State transition:
REFUNDcan only be reached fromSUCCESS. After a refund occurs, the order moves fromSUCCESStoREFUND; orders inPENDINGorFAILEDnever enterREFUND. - Not necessarily a full refund:
REFUNDonly means that a refund has occurred on the order. A cashin order can be partially refunded several times, and the order status isREFUNDafter a partial refund as well. To check whether the order has been fully refunded, compare the cumulative refunded principalrefund(see Cashin Refund Webhook and Query Refund) with the order'sTotal Amount payAmount. - Refund results come from the refund order: the result of each refund is given by the refund status
status(PENDING/SUCCESS/FAILED); do not use the order'sorderStatusto judge it.
5. Request Example
POST /notify/adopay/cashin HTTP/1.1
Host: merchant.example.com
Content-Type: application/json
X-Merchant-Id: 92315566000120
X-Timestamp: 1786838400
X-Nonce: 8f6e17d07f8b4fe19318d9c4dd6fc001
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>"
{
"status": 200,
"msg": "sucesso",
"event": "PIX_QRCODE_PAID",
"attach": "order-source=checkout",
"mchOrderNo": "CASHIN202608170001",
"platOrderNo": "BAS202608170000000001",
"orderStatus": "SUCCESS",
"amount": 100.25,
"payAmount": 100.25,
"fee": 1.25,
"payTime": 1786838400,
"e2eId": "E0000000020260817000000000000001",
"payerName": "JOAO DA SILVA",
"payerDocument": "12345678901"
}6. Merchant Response Requirements
The merchant must finish idempotent processing and respond within 3 seconds with HTTP 200—299 and a plain-text body of OK (SUCCESS is also accepted):
HTTP/1.1 200 OK
Content-Type: text/plain
OK7. Notification Scenarios and Retry Counts
Adopay sends this callback to the merchant when a cashin succeeds; for refund notifications see Cashin Refund Webhook.
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 Code | Response Body | Result |
|---|---|---|
200—299 | Exactly OK or SUCCESS after trimming leading and trailing whitespace | Notification succeeded; no more retries |
200—299 | Empty body, JSON, other text, or casing other than the required one | Notification failed; retries continue |
Not 2xx | Any content | Notification failed; retries continue |
| No HTTP response received | Network timeout or connection failure | Notification 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.
8. Integration Notes
- Verify that
eventisPIX_QRCODE_PAIDandorderStatusisSUCCESS. - When a success notification is received, you must verify
payAmountagainstamount. payerNameandpayerDocumentare sensitive information and should be stored masked in logs and audit systems.