Connect Webhooks
Events about the payments your app created and the businesses connected to it.
Connect Webhooks
Your app has its own Connect webhook, one per mode, separate from your business's own webhook. Set it in Developers → Apps → your app → Webhooks: the endpoint URL, the events you want (leave all unticked to receive every event) and the signing secret.
ePay sends a POST with a JSON body to your URL for each event. Every event names the connected business in account, so one endpoint serves all your connections.
Events
| Event | When |
|---|---|
payment.success · payment.failed · payment.cancelled · payment.reversed | A payment your app created changed status. |
payment.refunding · payment.refunded · payment.refund_failed | A refund of one of those payments progressed. |
product_fee.created | A payment your app created succeeded with an app fee. |
product_fee.refunded | A refund gave your app fee back. |
account.product.authorized | A business connected to your app. |
account.product.deauthorized | A connection was removed — by you, by the business, or by ePay. |
account.updated | A connection changed: pending_kyb → active, suspended or reactivated by ePay, upgraded from sandbox to live, or re-approved with a new scope. |
test | Sent from the dashboard with Send test event. |
Payment events are only sent for payments created through a connection. Payments the business takes itself go to its webhook, not yours.
Live payments and live connections are sent to your live endpoint; sandbox ones to your sandbox endpoint.
Payload
Payment events
{
"id": "evt_5c1e9a7d2b3f4e6a8c0d1e2f",
"object": "event",
"type": "payment.success",
"account": "acct_9Kd2mQ7xL4pR8sT1",
"livemode": true,
"created": "2026-10-29T10:05:00.000Z",
"data": {
"reference": "PAB12CD3420261029",
"merchantReference": "order_123",
"amount": "250.00",
"serviceFee": "5.00",
"currency": "ETB",
"status": "completed",
"paymentMethod": "telebirr",
"paidAt": "2026-10-29T10:04:58.000Z",
"createdAt": "2026-10-29T10:01:12.000Z"
}
}data.status is one of completed, failed, cancelled, reversed, refunding, refunded or refund_failed.
Account events
{
"id": "evt_8f2a6c4e1b9d3a7c5e0f2b4d",
"object": "event",
"type": "account.updated",
"account": "acct_9Kd2mQ7xL4pR8sT1",
"livemode": true,
"created": "2026-10-30T08:12:00.000Z",
"data": {
"account_id": "acct_9Kd2mQ7xL4pR8sT1",
"status": "active",
"scope": "read_write",
"livemode": true,
"livemode_enabled": true,
"connected_at": "2026-10-29T10:00:00.000Z",
"activated_at": "2026-10-30T08:12:00.000Z"
}
}data is the connection as it is when the event is sent. data.status is active, pending_kyb, suspended or revoked.
App fee events
product_fee.created and product_fee.refunded carry the product fee object in data — see App fees → Webhooks for an example.
Test event
{
"id": "evt_1a2b3c4d5e6f7a8b9c0d1e2f",
"object": "event",
"type": "test",
"account": null,
"livemode": false,
"created": "2026-10-31T09:00:00.000Z",
"data": {
"message": "Test event from the ePay dashboard. Verify the signature and return 2xx."
}
}Prop
Type
Verify the signature
Every request carries an X-Epay-Signature header:
X-Epay-Signature: sha256={hex_signature}It's an HMAC-SHA256 of the raw request body, keyed with your app's webhook signing secret for that mode. Compute it on your server and reject the request if it doesn't match. The signing secret is shown (and can be rotated) in Developers → Apps → your app → Webhooks; keep it on your server only.
Nothing NestJS-specific here — this is the same Node.js client call.
Nothing Django-specific here — this is the same Python client call.
Nothing Flask-specific here — this is the same Python client call.
Nothing FastAPI-specific here — this is the same Python client call.
Nothing Laravel-specific here — this is the same PHP client call.
Nothing Spring Boot-specific here — this is the same Java client call.
# Replay a signed event against your local endpoint while you build.
BODY='{"id":"evt_test","object":"event","type":"test","account":null,"livemode":false,"created":"2026-10-31T09:00:00.000Z","data":{}}'
SIG=$(printf '%s' "$BODY" \
| openssl dgst -sha256 -hmac "$EPAY_CONNECT_WEBHOOK_SECRET" -r \
| cut -d' ' -f1)
curl http://localhost:3000/webhooks/epay-connect \
-X POST \
-H "Content-Type: application/json" \
-H "X-Epay-Signature: sha256=$SIG" \
--data-raw "$BODY"import { createHmac, timingSafeEqual } from 'node:crypto';
function verifySignature(rawBody: Buffer, header: string, secret: string) {
const received = Buffer.from(header.replace('sha256=', ''));
const expected = Buffer.from(
createHmac('sha256', secret).update(rawBody).digest('hex'),
);
return received.length === expected.length && timingSafeEqual(received, expected);
}
// express.raw() keeps the body exactly as it arrived on the wire.
app.post(
'/webhooks/epay-connect',
express.raw({ type: 'application/json' }),
(req, res) => {
const sig = (req.headers['x-epay-signature'] as string) ?? '';
if (!verifySignature(req.body, sig, process.env.EPAY_CONNECT_WEBHOOK_SECRET!)) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(req.body.toString());
if (event.type !== 'test') queue.enqueue(event); // key on event.id
res.sendStatus(200);
},
);import hashlib
import hmac
import os
from flask import abort, request
def verify_signature(raw_body: bytes, header: str, secret: str) -> bool:
received = header.replace("sha256=", "")
expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(received, expected)
@app.post("/webhooks/epay-connect")
def epay_connect_webhook():
signature = request.headers.get("X-Epay-Signature", "")
# get_data() is the raw body — never re-serialize the parsed JSON.
if not verify_signature(request.get_data(), signature, os.environ["EPAY_CONNECT_WEBHOOK_SECRET"]):
abort(401)
event = request.get_json()
if event["type"] != "test":
queue.enqueue(event) # key on event["id"]
return "", 200function verify_signature(string $rawBody, ?string $header, string $secret): bool
{
if ($header === null) {
return false;
}
$received = str_replace('sha256=', '', $header);
$expected = hash_hmac('sha256', $rawBody, $secret);
return hash_equals($expected, $received);
}
// php://input is the raw body — never re-encode the decoded array.
$raw = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_EPAY_SIGNATURE'] ?? null;
if (!verify_signature($raw, $signature, getenv('EPAY_CONNECT_WEBHOOK_SECRET'))) {
http_response_code(401);
exit;
}
$event = json_decode($raw, true);
if ($event['type'] !== 'test') {
enqueue($event); // key on $event['id']
}
http_response_code(200);func verifySignature(body []byte, header, secret string) bool {
received := strings.TrimPrefix(header, "sha256=")
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
expected := hex.EncodeToString(mac.Sum(nil))
return hmac.Equal([]byte(received), []byte(expected))
}
func connectWebhook(w http.ResponseWriter, r *http.Request) {
// Read the body before decoding — never re-marshal a decoded struct.
body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
if err != nil {
http.Error(w, "unreadable body", http.StatusBadRequest)
return
}
sig := r.Header.Get("X-Epay-Signature")
if !verifySignature(body, sig, os.Getenv("EPAY_CONNECT_WEBHOOK_SECRET")) {
http.Error(w, "Invalid signature", http.StatusUnauthorized)
return
}
var event struct {
ID string `json:"id"`
Type string `json:"type"`
Account *string `json:"account"`
}
if err := json.Unmarshal(body, &event); err != nil {
http.Error(w, "bad json", http.StatusBadRequest)
return
}
if event.Type != "test" {
enqueue(body) // key on event.ID
}
w.WriteHeader(http.StatusOK)
}static boolean verifySignature(byte[] body, String header, String secret)
throws GeneralSecurityException {
if (header == null || !header.startsWith("sha256=")) {
return false;
}
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
String expected = HexFormat.of().formatHex(mac.doFinal(body));
// Constant-time comparison — never String.equals for a signature.
return MessageDigest.isEqual(
expected.getBytes(StandardCharsets.US_ASCII),
header.substring("sha256=".length()).getBytes(StandardCharsets.US_ASCII));
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, GeneralSecurityException {
byte[] body = request.getInputStream().readAllBytes();
String signature = request.getHeader("X-Epay-Signature");
if (!verifySignature(body, signature, System.getenv("EPAY_CONNECT_WEBHOOK_SECRET"))) {
response.sendError(401, "Invalid signature");
return;
}
queue.publish(body); // parse, skip "test", de-duplicate on "id"
response.setStatus(200);
}Node.js SDK support is coming soon. Switch to for a working example in Node.js today.
Python SDK support is coming soon. Switch to for a working example in Python today.
PHP SDK support is coming soon. Switch to for a working example in PHP today.
Java SDK support is coming soon. Switch to for a working example in Java today.
Go SDK support is coming soon. Switch to for a working example in Go today.
Verify against the raw body before parsing JSON, and compare with a
constant-time function (timingSafeEqual, hmac.compare_digest,
hash_equals, hmac.Equal, MessageDigest.isEqual).
Test your endpoint
In Developers → Apps → your app → Webhooks, click Send test event. ePay sends one signed test event to the URL saved for the dashboard's current mode — whatever events you subscribed to. It's tried once, and the result (your HTTP status and response body) appears under Recent deliveries a few seconds later.
Retries
Return a 2xx within 10 seconds. Otherwise ePay retries with exponential backoff, up to 5 attempts in total (about 1, 2, 4 and 8 minutes apart), then marks the delivery failed. Test events aren't retried.
Every attempt is listed under Recent deliveries with the request and your response.
Acknowledge fast and process asynchronously. Make your handler idempotent: the
same id can arrive more than once.
Next: Going live