Webhooks Notification
Novalnet uses notification webhooks to notify your server about the change in the status of a transaction asynchronously. The notification webhooks are endpoints that are essential to carry out the successful integration with Novalnet.
The common practices include events like when a customer pays the money to Novalnet account for Invoice payment type; a customer disputes a transaction (chargeback), or when a subscription renewal happens.
The notifications from the Novalnet server are posted for all transactions, including success, failures and follow-up transactions (return debit, chargeback, incoming credit, refund, subscription extension, etc.).
The following steps should be carried out for processing notification from Novalnet:
Step 1: Setup an endpoint on your server
Notifications are sent as HTTP callbacks (webhooks) to an endpoint on your server. To receive the notifications, you need a server that has the following:
- A possibility to receive a JSON or an HTTP POST request.
- The endpoint has to be HTTPS. Otherwise, your basic authentication credentials can be compromised.
- Make sure you have not made this webhook script with any htaccess authentication (username and password).
Refer to this >>link<< for the domain whitelisting as per your network or security requirements.
Step 2: Configuring the webhook endpoint
Webhook endpoints can be configured with Novalnet in either of the two ways,
a) Setting up the webhook through API:
Novalnet offers the possibility to configure the webhook URL via the API in transaction level or at the project level. You can set up the webhook URL via the API in one of the following ways, and the one which has been configured at the transaction level will be given the preference.
Webhook configuration at the project level:
To configure the webhook URL at the project level, refer to this >>link<< for the parameter details.
Webhook configuration at transaction level:
In the initial payment request, the parameter transaction.hook_url value had to be passed (based on your integration type) with an appropriate URL to use this option. As per your integration type, refer to the steps below,
- If you are using the hosted payment page integration, refer to this >>link<< for the parameter details.
- If you are using the direct API integration, refer to this >>link<< for the parameter details.
b) Configuring the webhook URL in the Novalnet Admin Portal:
To configure the webhook in your portal, follow the below steps,
- In your portal, navigate to the menu Projects
- Select the project from the list
- In the menu API Credentials, click on the Edit button from Vendor script URL / Notification & Webhook URL
- Enter the Vendor script URL / Notification & Webhook URL
Refer to the below-mentioned screen-shot for the details,
When the webhook endpoint URL is set through the payment request (as mentioned above), the notification will only be sent to that URL. Therefore, if you want the endpoint URL configured in the portal to be in effect, make sure you have discarded the dynamic transmission of the webhook endpoint URL(transaction.hook_url) in the payment request.
Step 3: Handling the notification
Once your webhook endpoint URL is setup, and you have started receiving the webhook notification, we insist you handle the notification in the following ways,
- Respond to the notification with a successful HTTP Status code - 200 so that the Novalnet server can identify that this notification has reached your endpoint successfully. Any other HTTP Status code will let Novalnet re-trigger the webhook notification to your endpoint URL again. Refer to this >>link<< to know more about the retrial mechanism.
- Verify the checksum included in the notification request. Through this, you can confirm that the notification sent by Novalnet is not manipulated. Refer to this >>link<< for performing the authentication.
- Store the notification request in your database.
- Based on the notification, identify the type of event (event.type) received and process the notification based on your business logic.
To know more about the events, types of events and samples - refer this >>link<<
Step 4: Test and go live
Before exposing your endpoint for realtime notifications, you need to test them first.
- Place a test transaction (after setting up the endpoint URL) and see whether you are able to receive and acknowledge the notifications properly. To place a test transaction, refer this >>link<< for more details.
- We also suggest you test all the webhook events that are related to your business logic.
- Once you have completed the tests successfully, your endpoint is now ready to process the realtime notifications.