Payment Webhooks
GatePass uses webhooks to notify your application when payment events occur. Payment webhooks are sent by payment providers (Paystack and Flutterwave) to confirm successful transactions and trigger ticket minting.Paystack Webhook
Receive payment notifications from Paystack.Endpoint
Headers
HMAC SHA512 signature of the request body using your Paystack secret key
Request content type
Webhook Events
GatePass processes the following Paystack webhook events:| Event | Description |
|---|---|
charge.success | Payment was successfully charged |
Request Body
The event type (e.g.,
charge.success)Response
Webhook acknowledgment status
Example Webhook Payload
Security Verification
Paystack webhooks use HMAC SHA512 signatures for verification:Signature Verification
/src/packages/server/src/routes/webhooks.ts:88-89
Flutterwave Webhook
Receive payment notifications from Flutterwave.Endpoint
Headers
Secret hash for webhook verification (matches
FLW_SECRET_HASH environment variable)Request content type
Webhook Events
GatePass processes the following Flutterwave webhook events:| Event | Description |
|---|---|
charge.completed | Payment transaction completed (check data.status for success) |
Request Body
The event type (e.g.,
charge.completed)Payment transaction data
Unique transaction reference matching the order
Flutterwave transaction ID
Payment status (e.g.,
successful, failed)Amount paid
Payment currency (e.g.,
NGN, USD)Customer information
Response
Webhook acknowledgment status
Example Webhook Payload
Security Verification
Flutterwave webhooks use a secret hash for verification:Signature Verification
/src/packages/server/src/utils/flutterwave.ts:58-61
Webhook Processing Flow
When a payment webhook is received and verified, GatePass performs the following actions:- Validate Signature - Verify webhook authenticity using HMAC/secret hash
- Find Order - Locate the order using the payment reference
- Update Payment Status - Mark order as
COMPLETEDand store transaction ID - Mint NFT Tickets - If event has a contract address, mint tickets on blockchain
- Create Tickets - Store ticket records with token IDs and transaction hash
- Send Notification - Notify user of successful purchase
Testing Webhooks
Using ngrok for Local Development
Manual Testing
Error Handling
| Status Code | Description |
|---|---|
200 | Webhook processed successfully |
401 | Invalid or missing signature |
500 | Server configuration error (missing secret key) |
Best Practices
- Always verify webhook signatures before processing
- Respond quickly (within 5 seconds) to avoid retries
- Implement idempotency to handle duplicate webhooks
- Log webhook payloads for debugging and audit trails
- Use environment variables for secret keys
- Monitor webhook delivery in payment provider dashboards
Related Resources
Webhook Verification
Learn how to securely verify webhook signatures
Orders API
Manage ticket orders and payments