Webhooks & Notifications
Introduction
Webhooks allow your application to receive real-time updates about payment statuses from Resmic Pro. This ensures that you are notified immediately when a payment is completed, pending, or failed. You can either provide an endpoint to receive webhook notifications or opt for email updates (not recommended for real-time processing).
Configuring Webhooks
Option 1: Providing a Webhook URL (Recommended)
To receive automatic updates, configure a webhook endpoint in your Resmic Pro dashboard:
Just append the
web_hook urlwhile initiating the payment session
Whenever a payment status is updated, Resmic Pro will send a POST request to the configured URL.
You will required Webhook secret to verify the data you received is correct.
To generate the webhook secret visit: https://dashboard.resmic.com/developer
Example Server Webhook Response
{
session_id,
amount,
blockchain,
token,
from_wallet_address,
transaction_hash,
txTime,
status:true
} Option 2: Receiving Email Notifications (Not Recommended)
If you prefer, you can opt to receive payment updates via email instead of webhooks.
To enable email notifications:
Just add email address at the webhook_url while initiating the payment
Whenever a payment status is updated, you will receive an email notification containing the payment details.
Handling Webhook Notifications
When you receive a webhook notification, your server should:
Parse the JSON payload.
Verify the
session_idandstatusfields.Update your database accordingly.
Respond with a
200 OKto acknowledge receipt.
E.g. Success Payment response
`req.body`
Failed Payment response
`req.body`
Sample Webhook endpoint
Conclusion
By configuring webhooks, you can automatically track payment updates in real-time. If webhooks are not an option, email notifications can serve as an alternative.
Last updated