N
NexttPay

Developers / Webhooks

Webhooks

Receive real-time updates for payments, payouts, and events. Build reliable, event-driven payment flows with NexttPay.

How Webhooks Work

Step 1

Event Occurs

A payment or payout event is triggered on the platform.

Step 2

Webhook Sent

We send a POST request to your configured endpoint.

Step 3

You Handle It

Your server processes the event and returns a 2xx response.

Event Types

payment.created

Triggered when a payment is initiated.

payment.succeeded

Triggered when a payment is successfully completed.

payment.failed

Triggered when a payment fails.

payout.completed

Triggered when a payout is successfully processed.

payout.failed

Triggered when a payout fails.

Verify Signatures

Always verify webhook signatures to ensure requests are sent by NexttPay and not malicious actors.

X-NexttPay-Signature: t=timestamp,v1=signature

Retry & Reliability

If your endpoint fails to respond with a 2xx status, webhook delivery will be retried automatically with exponential backoff.

• Automatic retries for failed deliveries

• Idempotent event handling recommended

• Logs available in dashboard

Example Handler

Here’s a simple Node.js example for handling webhook events.

• Parse incoming JSON payload

• Verify signature

• Handle event type

import express from "express"; const app = express(); app.post("/webhook", (req, res) => { const event = req.body; switch (event.type) { case "payment.succeeded": console.log("Payment success:", event.data); break; case "payment.failed": console.log("Payment failed:", event.data); break; } res.sendStatus(200); });

Build event-driven flows

Use webhooks to automate payments, notifications, and business logic.