πΈοΈHandling Webhooks
Learn how to listen for webhook events executed on Lamba
Receiving webhooks (POST method)
In your webhook endpoint for low_fi, you can obtain the webhook payload in the form:
{
"encryption_key": "enc_key", // your encryption key
"action_id": "action_id", // the id of the action on Lamba
"order_id": "order_id", // your `orderId`
"payment_info": {
"currency": "currency",
"amount": 45
}
}Please take note of the following points when handling your webhooks:
Your webhook endpoint must be able to accept a
POSTrequest withJSONpayload.Validate the
encryption_keyto ensure it matches the one in your.envfile, specifically the encryption key in your app'sAPI keyssection in your Lamba dashboard.Verify the amount and currency returned to confirm they match the value indicated by your
order_idin your database. Do not mark the order as fulfilled/completed if the values do not match, as they could have been maliciously tampered with on the client.Choose to either record the
actionIdto your order record in the database or discard it, noting that it can always be retrieved by querying thefetching paymentactions endpoint on Lamba API with yourorderId.Acknowledge the webhook notification within
60seconds to prevent timeouts. Perform any other business logic in the background and quickly return a status code within the range200 - 299to acknowledge receipt of the webhook notification.Be aware that failed webhook notifications are resent every
60seconds for the next12 minutes(if it keeps failing). After this period, no further notifications will be sent. You must then use yourorderIdto query the Lamba APIfetching paymentactions endpoint to fetch the transaction yourself and validate that the status isfulfilled. If the status is notfulfilled, do not credit the user.
Last updated
Was this helpful?