Webhooks
Get notified on your server the moment something happens on your account, such as a successful payment or a completed refund.
Some payments finish after your customer has left your page. A customer may approve a Mobile Money prompt a minute later, or close their browser before returning to your callback URL. Webhooks make sure you still hear about it: we send an HTTPS POST request to your webhook URL for every event.
Set up your webhook URL
- Create an endpoint on your serverIt must accept
POSTrequests with a JSON body and be reachable from the internet. Live webhook URLs must use HTTPS. - Add the URL to your dashboardOpen API & Sandbox and enter your test webhook URL. You can add a live webhook URL after your business is approved.
- Verify every requestCheck the signature as shown below before you trust the event.
Events
| Event | Sent when |
|---|---|
charge.success | A payment succeeded. |
charge.failed | A payment failed, including when a customer never approved a Mobile Money prompt. |
refund.pending | A refund was sent to the network and is waiting for confirmation. |
refund.processed | A refund reached the customer. |
refund.failed | A refund could not be completed. The amount is back on your balance. |
settlement.success | A payout reached your payout account. |
settlement.failed | A payout could not be paid. The amount is back on your balance. |
Every request has a JSON body with event and data. For charge events, data has the same shape as Verify Transaction; for refund events, the same shape as Fetch Refund; for settlement events, the same shape as Fetch Settlement. Settlement events are live only.
{
"event": "charge.success",
"data": {
"id": 173,
"domain": "test",
"status": "success",
"reference": "WG2611096D4HQE52FMY9KW",
"amount": 5000,
"requested_amount": 5000,
"message": null,
"gateway_response": "Approved",
"paid_at": "2026-11-09T01:03:40.000Z",
"created_at": "2026-11-09T01:03:40.000Z",
"channel": "mobile_money",
"currency": "GHS",
"ip_address": "154.160.2.17",
"metadata": {
"order_id": "1042"
},
"fees": 98,
"fee_bearer": "merchant",
"refunded_amount": 0,
"customer": {
"id": 169,
"first_name": null,
"last_name": null,
"email": "customer@email.com",
"customer_code": "CUS_c0473agwwkdxmih",
"phone": null,
"metadata": null,
"risk_action": "default",
"createdAt": "2026-11-09T01:03:40.000Z",
"updatedAt": "2026-11-09T01:03:40.000Z"
},
"authorization": {
"channel": "mobile_money",
"bank": "MTN",
"last4": "4987",
"country_code": "GH",
"reusable": false,
"mobile_money_number": "23355****87"
}
}
}{
"event": "refund.processed",
"data": {
"id": 34,
"integration": 100231,
"domain": "test",
"transaction": 173,
"transaction_reference": "WG2611096D4HQE52FMY9KW",
"amount": 2000,
"currency": "GHS",
"status": "processed",
"refunded_by": "merchant_api",
"customer_note": null,
"merchant_note": "Item out of stock",
"refunded_at": "2026-11-09T01:03:40.000Z",
"createdAt": "2026-11-09T01:03:40.000Z"
}
}{
"event": "settlement.success",
"data": {
"id": 42,
"reference": "STL_76A3987C17",
"integration": 78,
"domain": "live",
"status": "success",
"type": "requested",
"currency": "GHS",
"total_amount": 3000,
"total_fees": 59,
"total_refunds": 0,
"net_amount": 2941,
"payout_fee": 100,
"effective_amount": 2841,
"transaction_count": 1,
"destination": {
"type": "mobile_money",
"name": "MTN MoMo ending 4561",
"account_name": "AMA MENSAH",
"last4": "4561"
},
"failure_reason": null,
"period_start": "2026-11-11T07:56:02.000Z",
"period_end": "2026-11-11T07:56:02.000Z",
"settlement_date": "2026-11-12T13:56:05.000Z",
"createdAt": "2026-11-12T13:56:02.000Z",
"updatedAt": "2026-11-12T13:56:05.000Z"
}
}Verify the signature
Anyone can send a request to your URL, so check that each one came from Wire Gh. Every request has these headers:
| Header | Value |
|---|---|
x-wiregh-signature | HMAC SHA512 of the raw request body, using your secret key, as lowercase hex. |
x-wiregh-event-id | A unique ID for the event. It stays the same when we retry. |
Compute the same HMAC over the raw body and compare it with the header using a constant time comparison. Use the secret key of the same mode: test events are signed with your test secret key, live events with your live secret key. If you regenerate a secret key, new events are signed with the new key.
const crypto = require('crypto');
const express = require('express');
const app = express();
// Keep the raw body: the signature is computed over the exact bytes we send.
app.post('/webhooks/wiregh', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.get('x-wiregh-signature') || '';
const expected = crypto
.createHmac('sha512', process.env.WIREGH_SECRET_KEY)
.update(req.body)
.digest('hex');
const valid = signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
if (!valid) return res.sendStatus(401);
res.sendStatus(200); // answer first, then do the work
const eventId = req.get('x-wiregh-event-id');
const { event, data } = JSON.parse(req.body.toString('utf8'));
// Skip eventId if you have already handled it, then:
if (event === 'charge.success') {
// verify data.reference and data.amount against your order, then give value
}
});
app.listen(3000);<?php
// webhooks/wiregh.php
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WIREGH_SIGNATURE'] ?? '';
$expected = hash_hmac('sha512', $payload, getenv('WIREGH_SECRET_KEY'));
if (!hash_equals($expected, $signature)) {
http_response_code(401);
exit;
}
http_response_code(200); // answer first, then do the work
$eventId = $_SERVER['HTTP_X_WIREGH_EVENT_ID'] ?? '';
$body = json_decode($payload, true);
// Skip $eventId if you have already handled it, then:
if ($body['event'] === 'charge.success') {
$tx = $body['data'];
// verify $tx['reference'] and $tx['amount'] against your order, then give value
}Compute the signature over the body exactly as you received it. If your framework parses the JSON first and you encode it again, the bytes change and the signature will not match.
Respond quickly
Reply with any 2xx status code within 15 seconds to tell us you received the event. Do slow work, such as sending emails or calling other services, after you reply or in a background job.
Retries
If your server does not reply with 2xx, or takes longer than 15 seconds, we try again after 1 minute, 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours, 12 hours and 24 hours, up to 8 attempts in total.
Because of retries, the same event can reach you more than once. Use x-wiregh-event-id, or the transaction reference, to make sure you handle each event only once.
Checklist
- Your URL is reachable from the internet, and uses HTTPS in live mode. Local and private addresses are refused.
- You check
x-wiregh-signatureon every request. - You reply with
200before doing slow work. - You ignore events you have already handled.
- For
charge.success, you still check the amount against your order before giving value.