Snappy Checkout
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.
Webhooks
Event Notification
You 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 Webhooks
After 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:

  1. Go to https://webhook.site (and keep this webpage open).
  2. Copy the unique URL from the top of the web broswer into the Snappy Checkout “Payment Received URL” box.
  3. Click the “Test” button to the right of the "Payment Received URL" text box.
  4. Refresh the Webhook Tester webpage and you'll see the data Snappy Checkout sent via the HTTP POST request.
Webhook Identifiers
The following values may appear in the received data:

  • ProductId --> What you entered in the “Product ID” text box when creating your product in the Products section of the Snappy Checkout admin.
  • Passthrough --> A unique value specified by you (like the customer's unique id from your database) and passed by your checkout to the Snappy Checkout back-end. You can use this value to verify which customer made the payment.

Here's an example of how the passthrough value would be set in your checkout:

<script src="https://s3.amazonaws.com/snappycheckout/Button.js" class="checkout-button" id="TEST3FG5WQ212VBTEST" label="Buy Now" passthrough="12345"></script>

Or, auto launch your checkout by adding the following JavaScript to the bottom of your webpage (right above the closing </BODY> tag). This will cause your checkout to pop up as soon as the webpage loads.

<script src="https://s3.amazonaws.com/snappycheckout/Button.js"></script> <script>Checkout.loadButton("TEST3FG5WQ212VBTEST", "12345");</script>

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:

<script src="https://s3.amazonaws.com/snappycheckout/Button.js"></script> <script>Checkout.loadButton("TEST3FG5WQ212VBTEST", "?Plan=sat-enhanced&InstallationDate=07-12-2018");</script>
Responding to a Webhook
To 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 Practices
If 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.
© Snappy Checkout
support@snappycheckout.com