I'm Mike Singer, the founder & developer of Snappy Checkout. I'm here to help if you have any questions that are not covered below. Feel free to email me anytime.
Event NotificationYou can use webhooks to be notified when you receive a new payment. These webhooks can be set up in the Account --> Webhooks section of the Snappy Checkout admin. After entering a webhook URL, you'll be notified via an HTTP POST request whenever the event occurs.
The Events --> Webhooks section of the Snappy Checkout admin lists all of the webhooks that have been delivered to you. You'll also be able to see the information that was passed in the webhooks and the responses from the URL that received the webhooks.
Testing WebhooksAfter enter the webhook URL in the Account --> Webhooks section of the Snappy Checkout admin, click the “Test” button to send an HTTP POST request with sample data to the specified URL.
Follow these steps to see what kind of data a webhook sends:
Webhook IdentifiersThe following values may appear in the received data:
Here's an example of how the passthrough value would be set in your checkout:
Note: You'll have to replace the above id values with the values for your product in order for this example code to actually work. Click the link icon to the right of your product in the “Products” section of the Snappy Checkout admin to locate your product id.
If your webhook endpoint is expecting specific key-value pairs to be included, then store that data in the passthrough value like this:
Responding to a WebhookTo acknowledge receipt of a webhook, the endpoint should return a 2xx HTTP status code. All response codes outside this range will indicate to Snappy Checkout that the webhook was not received. Snappy Checkout will ignore any other information returned in the request headers or request body.
If the endpoint does not successfully receive a webhook for any reason, Snappy Checkout will continue trying to send the webhook throughout the next 24 hours. Webhooks can also be manually retried in the Events section of your Snappy Checkout account.
Best PracticesIf your webhook script performs complex logic, or makes network calls, it's possible that the script would time out before Snappy Checkout sees its complete execution. For that reason, you might want to have your webhook endpoint immediately acknowledge receipt by returning a 2xx HTTP status code, and then perform the rest of its duties.
Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you've processed, and then not processing already-logged events.