Learn how to listen to events whenever certain actions occur on your integration.

What are webhooks?

Whenever certain transaction actions occur on your Paystack integration, we trigger events which your application can listen to. This is where webhooks come in. A webhook is a URL on your server where we send payloads for such events. For example, if you implement webhooks, once a payment is successful, we will immediately notify your server with a charge.success event. Here is a list of events we can send to your webhook URL.

Helpful Tip
We recommend that you use webhook to provide value to your customers over using a callback. Callbacks can fail if the network connection on a customer's device fails or is weak or if the device goes off after a transaction and several other situations that are outside both our and your control.

You can specify your webhook URL on your dashboard where we would send POST requests to whenever an event occurs.

Here are some things to note when setting up a webhook URL:

  1. If using .htaccess, remember to add the trailing / to the url you set.
  2. Do a test post to your URL and ensure the script gets the post body.
  3. Ensure your webhook URL is publicly available (localhost URLs cannot receive events)

Receiving an event

All you have to do to receive the event is to create an unauthenticated POST route on your application. The event object is sent as JSON in the request body.

1// Using Express
2app.post("/my/webhook/url", function(req, res) {
3 // Retrieve the request's body
4 var event = req.body;
5 // Do something with event
6 res.send(200);

Verifying events

It is important to verify that events originate from Paystack to avoid delivering value based on a countefeit event.

You can do any or both of the below to verify events from Paystack:

  1. Validate the Signature - Valid events are raised with an header X-Paystack-Signature which is essentially a HMAC SHA512 signature of the event payload signed using your secret key.
  2. Watch the IPs - We only call your webhooks from these IPs:,,

You can whitelist these IPs. Any webhook from outside of these can safely be considered counterfeit.

Show Response
1var crypto = require('crypto');
2var secret = process.env.SECRET_KEY;
3// Using Express
4app.post("/my/webhook/url", function(req, res) {
5 //validate event
6 var hash = crypto.createHmac('sha512', secret).update(JSON.stringify(req.body)).digest('hex');
7 if (hash == req.headers['x-paystack-signature']) {
8 // Retrieve the request's body
9 var event = req.body;
10 // Do something with event
11 }
12 res.send(200);

Responding to an event

You should respond to an event with a 200 OK. We consider this an acknowledgement by your application. If your application responds with any status outside of the 2xx range, we will consider it unacknowledged and thus, continue to send it every hour for 72 hours. You don't need to send a request body or some other parameter as it would be discarded - we only pay attention to the status code.

If your application is likely to start a long running task in response to the event, Paystack may timeout waiting for the response and would ultimately consider the event unacknowledged and queue to be raised later. You can mitigate duplicity by having your application respond immediately with a 200 before it goes on to perform the rest of the task.

Supported events

2 "event": "customeridentification.failed",
3 "data": {
4 "customer_id": "9387490384",
5 "customer_code": "CUS_xnxdt6s1zg1f4nx",
6 "email": "[email protected]",
7 "identification": {
8 "country": "NG",
9 "type": "bvn",
10 "value": "200*****677"
11 }
12 }

Types of events

Here are the events we currently raise. We would add more to this list as we hook into more actions in the future.

charge.dispute.createA dispute was logged against your business
charge.dispute.remindA logged dispute has not been resolved
charge.dispute.resolveA dispute has been resolved
charge.successA successful charge was made
customeridentification.failedA customer ID validation has failed
customeridentification.successA customer ID validation was successful
invoice.createAn invoice has been created for a subscription on your account. This usually happens 3 days before the subscription is due or whenever we send the customer their first pending invoice notification
invoice.payment_failedA payment for an invoice failed
invoice.updateAn invoice has been updated. This usually means we were able to charge the customer successfully. You should inspect the invoice object returned and take necessary action
paymentrequest.pendingA payment request has been sent to a customer
paymentrequest.successA payment request has been paid for
subscription.createA subscription has been created
subscription.disableA subscription on your account has been disabled
subscription.expiring_cardsContains information on all subscriptions with cards that are expiring that month. Sent at the beginning of the month, to merchants using Subscriptions
subscription.not_renewA subscription on your account's status has changed to non-renewing. This means the subscription will not be charged on the next payment date
transfer.failedA transfer you attempted has failed
transfer.successA successful transfer has been completed
transfer.reversedA transfer you attempted has been reversed