Unsuccessful Purchase Event
The Unsuccessful Purchase Event webhook response is triggered when a data purchase through the DiscountData API encounters an error or fails to complete successfully. This webhook provides you with real-time information about the unsuccessful purchase, allowing you to handle the error gracefully and take appropriate actions to resolve the issue.
Example Payload
Here's an example of an Unsuccessful Purchase Event webhook payload:
In the example above, the payload indicates that a data purchase for the mobile number 0815xxxxxxx with the data plan "500MB Plan" failed due to invalid Airtel Number. The data->true_response provides additional details regarding the error encountered.
Please note that the actual payload you receive will correspond to the specific unsuccessful purchase event and may contain additional fields or information depending on the encountered error.
Handling Unsuccessful Purchase Events
When you receive an Unsuccessful Purchase Event webhook, you should handle the error gracefully and take appropriate actions, such as:
Notifying the user about the failed purchase and providing guidance on how to resolve the issue.
Logging the error for further investigation and troubleshooting.
Offering alternative data plans or suggestions to the user based on the encountered error.
Implementing automated processes to retry the purchase or refund the user if applicable.
It is important to have robust error-handling mechanisms in place to ensure a smooth user experience and prompt resolution of any issues encountered during the data purchase process.
Response Format
As a best practice, you should respond to the webhook with an HTTP status code of 200 (OK) to acknowledge the successful receipt of the webhook notification. If your endpoint returns a status code outside the 2xx range, the DiscountData system may attempt to resend the webhook notification at a later time.
Retry and Redelivery
In some cases, due to network issues or temporary unavailability of your webhook endpoint, the DiscountData system may retry sending the webhook notification. These retry attempts are typically made at regular intervals for a certain period. If your endpoint responds with a non-success status code (e.g., 5xx) or is consistently unavailable, the system may stop retrying and discard the webhook notification.
It is recommended to implement appropriate retry mechanisms on your side to handle any transient errors or temporary unavailability of your webhook endpoint.
Now that you understand the structure and purpose of the Unsuccessful Purchase Event webhook response, you can incorporate this information into your systems to handle errors gracefully and provide timely assistance to your users.
If you have any further questions or require assistance regarding the Unsuccessful Purchase Event webhook or any other aspect of webhooks in the DiscountData API, please don't hesitate to contact our support team.
Let's continue exploring the other webhook responses available in the DiscountData API!
Last updated