Webhooks
Receive IVB transaction updates on your server and verify webhook signatures before processing events.
Webhooks let Ivorypay push real-time notifications to your server whenever a transaction changes state. Instead of polling the API, your server receives an HTTP POST request the moment something happens.
Delivery method: POST to your registered URL
Signature header: x-ivorypay-signature
Setup
Webhook configuration is done through your Ivorypay Merchant Dashboard under Settings → Webhooks. From there you can:
Register a webhook URL for your TEST or LIVE environment
Choose which events to subscribe to
Update or remove your webhook at any time
You can have one webhook per environment: one for
TESTand one forLIVE.
How It Works
1. Set your webhook URL in the Merchant Dashboard
2. A transaction status changes
3. Ivorypay POSTs to your URL → { event, data } + signature header
4. Your server responds with HTTP 200 → Delivery confirmedIf your server does not return 200, Ivorypay will retry delivery automatically.
Receiving Webhooks
Ivorypay sends a POST request to your registered URL with the following structure:
Request Headers
Content-Type
application/json
x-ivorypay-signature
HMAC-SHA512 of compact JSON data only
Request Body
Payload Fields
event
string
The event that triggered this webhook (e.g. cryptoCollection.success).
data.reference
string
Your unique transaction reference (UUID).
data.status
string
Current status: PENDING, PROCESSING, SUCCESS, or FAILED.
data.token
string
Crypto token involved (e.g. USDT, USDC).
data.address
string
Wallet address for crypto transactions.
data.expectedAmountInCrypto
string
Amount expected to be received.
data.receivedAmountInCrypto
string
Amount actually received on-chain.
data.settledAmountInCrypto
string
Amount settled after fees.
data.cryptoTransactionHash
string
On-chain transaction hash. null until confirmed.
data.environment
string
TEST or LIVE.
data.expiresAt
string
ISO timestamp when the payment window closes.
data.completedAt
string
ISO timestamp when the transaction was finalised. null if pending.
data.failureReason
string
Human-readable reason for failure. null if not failed.
data.metadata
object
Custom metadata you passed when creating the transaction.
Verifying the Signature
Ivorypay sends { "event": "...", "data": {...} } and signs only the compact JSON representation of data, using HMAC-SHA512 and the secret API key for the webhook's business and environment. The header x-ivorypay-signature is a 128-character hexadecimal digest. There is no separate webhook secret.
Do not hash the complete request body. Do not pretty-print, reorder keys or change number formatting before checking the signature. For Python, preserve the original data JSON bytes rather than re-serializing parsed numbers.
The signature does not cover the outer event label. Use verified data and an authenticated status read to decide whether to fulfil an order. Never grant value from the event name alone. Key rotation also changes the key you need for verification.
Node.js
This function accepts the raw request body as a Buffer, the signature header, and your environment's secret key. Node's JSON.stringify matches the signing representation.
For Express, register express.raw({ type: 'application/json', limit: '1mb' }) on the webhook route before a global JSON parser. Pass req.body, req.get('x-ivorypay-signature'), and your stored secret to this function. Reject invalid signatures with HTTP 401.
Python
This standalone function accepts raw UTF-8 request bytes. It locates the top-level data value with Python's JSON decoder and hashes its original bytes. It does not use a regular expression to parse JSON.
For Flask, obtain raw bytes with request.get_data() before any middleware transforms the body. Apply a request-size limit. Return HTTP 401 on a verification failure.
Acknowledge and process safely
Verify the signature using the matching environment key.
Persist the event or enqueue it durably. Do not acknowledge a message that exists only in memory.
Return HTTP
200promptly. Other status codes are treated as delivery failures.Process asynchronously and idempotently. A reference can receive several status events; do not discard later updates just because you saw that reference before. Deduplicate the same event/status while fulfilling each successful order once.
Match the saved order's reference, currency and amount using an authenticated status read. Reconcile delayed or missing webhooks with the API.
Events can be duplicated, delayed or arrive out of order. A valid signature is not a replay-prevention mechanism. Store processed event identities and enforce one fulfilment per order in your database.
Event Types
Events follow the pattern <category>.<status>.
Collection Events
Triggered when a customer makes a payment to your business.
cryptoCollection.pending
A crypto payment request was created and is awaiting payment.
cryptoCollection.processing
Crypto payment detected on-chain, awaiting confirmations.
cryptoCollection.success
Crypto payment fully confirmed and received.
cryptoCollection.failed
Crypto payment expired or failed.
fiatCollection.pending
A fiat payment request was created and is awaiting payment.
fiatCollection.processing
Fiat payment received, being verified.
fiatCollection.success
Fiat payment confirmed and received.
fiatCollection.failed
Fiat payment failed or was not received in time.
1Voucher payments use these same fiat collection events. A synchronous provider result does not replace the retained Business payment status, signature verification or idempotent fulfilment.
Payout Events
Triggered when you send funds to a recipient.
cryptoPayout.pending
A crypto transfer was initiated and is queued.
cryptoPayout.processing
Crypto transfer has been broadcast to the blockchain.
cryptoPayout.success
Crypto transfer confirmed on-chain. Funds delivered.
cryptoPayout.failed
Crypto transfer failed. A reservation may remain until the outcome is reconciled.
fiatPayout.pending
A fiat transfer was initiated and is queued.
fiatPayout.processing
Fiat transfer submitted to the bank for processing.
fiatPayout.success
Fiat transfer completed. Funds delivered to recipient's account.
fiatPayout.failed
Fiat transfer failed. A reservation may remain until the outcome is reconciled.
Settlement Events
Triggered when collected funds are settled to your wallet or bank account.
cryptoSettlement.pending
Crypto settlement initiated, waiting to be processed.
cryptoSettlement.processing
Crypto settlement is being sent to your wallet.
cryptoSettlement.success
Crypto settlement completed. Funds in your wallet.
cryptoSettlement.failed
Crypto settlement failed.
fiatSettlement.pending
Fiat settlement initiated, waiting to be processed.
fiatSettlement.processing
Fiat settlement is being sent to your bank account.
fiatSettlement.success
Fiat settlement completed. Funds in your bank account.
fiatSettlement.failed
Fiat settlement failed.
Swap Events
Triggered when a token swap is performed on collected funds.
swap.pending
A token swap was initiated and is queued.
swap.processing
Token swap is being executed.
swap.success
Token swap completed successfully.
swap.failed
Token swap failed.
Refund Events
Triggered when a collected payment is refunded to the customer.
cryptoCollectionRefund.pending
Crypto refund initiated, waiting to be processed.
cryptoCollectionRefund.processing
Crypto refund is being sent back to the customer's wallet.
cryptoCollectionRefund.success
Crypto refund completed. Funds returned to customer.
cryptoCollectionRefund.failed
Crypto refund failed.
fiatCollectionRefund.pending
Fiat refund initiated, waiting to be processed.
fiatCollectionRefund.processing
Fiat refund is being sent to the customer's bank account.
fiatCollectionRefund.success
Fiat refund completed. Funds returned to customer's bank.
fiatCollectionRefund.failed
Fiat refund failed.
Permanent Wallet Deposit Events
Triggered when a deposit is received on a customer's permanent blockchain address (generated via POST /v1/blockchain-accounts/create).
permanentWalletDeposit.pending
A deposit was detected on the permanent wallet address and is queued.
permanentWalletDeposit.processing
Deposit is being confirmed on-chain.
permanentWalletDeposit.success
Deposit fully confirmed and credited.
permanentWalletDeposit.failed
Deposit failed or could not be processed.
Static Account Deposit Events
staticAccountDeposit.pending
Deposit is pending
staticAccountDeposit.processing
Deposit is being processed
staticAccountDeposit.success
Deposit completed
staticAccountDeposit.failed
Deposit failed
Subscription Invoice Events
invoice.create and invoice.payment_failed carry billing-attempt information. See subscriptions for payloads and reconciliation. An invoice-created notification is not payment confirmation.
Best Practices
Acknowledge durable receipt with HTTP 200. Verify first, persist or enqueue durably, then return 200 and process asynchronously.
Verify the signature. Reject any request where the x-ivorypay-signature doesn't match. This protects against spoofed requests.
Handle duplicates. Webhooks may be delivered more than once. Deduplicate by event identity and reference/status; guard successful order fulfilment separately. Subscription invoice events include a stable x-ivorypay-event-id.
Subscribe only to what you need. Only subscribe to events relevant to your integration. This keeps your handler logic focused and your logs clean.
Use TEST environment first. Configure a webhook in the TEST environment and validate all your event handlers before switching to LIVE.
Last updated