Webhooks
When an order reaches SUCCESS, FAILED or RETURNED, EasyPay sends a POST to the notify_url given at creation. A cancellation you requested is not notified, nor is PENDING → PROCESSING.
Request
Headers are exactly those of request signing; verify with your app_secret:
| Header | Value |
|---|---|
X-App-Id | The App id used for the order |
X-Timestamp | Unix seconds at send time |
X-Nonce | 32 hex chars, random |
X-Signature | hex(HMAC-SHA256(app_secret, "POST\n<path>\n<timestamp>\n<nonce>\n<hex(sha256(body))>")) |
Content-Type | application/json |
User-Agent | EasyPay-Webhook/1.0 |
path is the path part of notify_url (https://merchant.example.com/webhooks/easypay?x=1 → /webhooks/easypay, no query). The body is hashed as raw bytes: verify before you parse.
Body:
{
"event": "payout.succeeded",
"event_id": "PO2026101408050047391520BRPX:SUCCESS",
"occurred_at": "2026-10-14T08:05:00Z",
"attempt": 1,
"data": { "trade_no": "PO2026101408050047391520BRPX", "status": "SUCCESS", "...": "same structure as /payout/query" }
}| Field | Description |
|---|---|
event | payout.succeeded / payout.failed / payout.returned |
event_id | <trade_no>:<status>; identical on every retry of the same event — deduplicate on it |
occurred_at | When the channel reported the change (UTC) |
attempt | Delivery attempt, 1–7 |
data | The order, same structure as /payout/query. data.status is the state at send time; update your records from it. event is only the trigger |
An order produces at most two events: SUCCESS may be followed by RETURNED.
Response and retries
Any 2xx acknowledges; the response body is ignored. A timeout (10 s), connection error or non-2xx is retried after 1 m / 5 m / 30 m / 2 h / 6 h / 24 h — seven attempts in total. After that no more deliveries are made; /payout/query always has the final state.
Recommended: verify, enqueue, answer 200 immediately, and process asynchronously, so slow processing never triggers retries.
Security requirements
notify_urlmust be a publicly reachablehttps://URL. Private / loopback addresses andlocalhost-style names are rejected at creation, and hostnames resolving to private IPs are refused at send time.- Redirects are not followed;
notify_urlmust answer 2xx directly. - Drop and alert on requests that fail verification. The signature proves the request came from EasyPay and the body is untouched.
Verification examples
const crypto = require('crypto');
// rawBody must be the raw bytes (express: express.raw({ type: 'application/json' }))
function verify(req, rawBody, appSecret) {
const h = (k) => String(req.headers[k.toLowerCase()] ?? '');
const bodyHash = crypto.createHash('sha256').update(rawBody).digest('hex');
const sts = ['POST', new URL(req.url, 'https://x').pathname, h('X-Timestamp'), h('X-Nonce'), bodyHash].join('\n');
const want = crypto.createHmac('sha256', appSecret).update(sts).digest('hex');
const got = h('X-Signature').toLowerCase();
return got.length === want.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(got));
}import hashlib, hmac
from flask import request
def verify(app_secret: str) -> bool:
raw = request.get_data() # raw bytes
body_hash = hashlib.sha256(raw).hexdigest()
sts = "\n".join(["POST", request.path, request.headers["X-Timestamp"], request.headers["X-Nonce"], body_hash])
want = hmac.new(app_secret.encode(), sts.encode(), hashlib.sha256).hexdigest()
return hmac.compare_digest(want, request.headers.get("X-Signature", "").lower())func verify(r *http.Request, raw []byte, appSecret string) bool {
sum := sha256.Sum256(raw)
sts := strings.Join([]string{"POST", r.URL.Path, r.Header.Get("X-Timestamp"), r.Header.Get("X-Nonce"), hex.EncodeToString(sum[:])}, "\n")
mac := hmac.New(sha256.New, []byte(appSecret))
mac.Write([]byte(sts))
want := hex.EncodeToString(mac.Sum(nil))
return hmac.Equal([]byte(want), []byte(strings.ToLower(r.Header.Get("X-Signature"))))
}Suggested handling
- Verification fails → answer 401, alert.
- Look up
event_id; already processed → answer 200. - Update the local order from
data.status(it only moves forward:SUCCESSmay becomeRETURNED, never back). - Answer 200.