The Voucherify Developer Hub

Welcome to the Voucherify developer hub. You'll find comprehensive guides and documentation to help you start working with Voucherify as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Instead of polling data from Voucherify endpoints, you can use webhooks to get notified when:

More events available

Contact our support to request firing a webhook for any event from this list.

Redemption webook

The webhook can be configured in the Project Settings view, in the Webhooks section.

Voucherify makes it possible to define multiple redemption webhooks. To add one, you should press the :heavy-plus-sign+: button and start off by providing a target URL. Then, you can configure when the URL should be called.

There are 2 options:

  • call a webhook for every redemption
  • call a webhook given the one or many of following redemption statuses occurred: redemption succeeded, redemption failed, redemption rollback succeeded, redemption rollback failed

When all the webhook features are set, confirm it with CREATE ENDPOINT.

From now on when Voucherify will call your endpoint providing redemption information in the payload.

Referral reward webhook

The webhooks are also an integral part of referral programs. The endpoints are defined while defining a referral program and they are invoked when the referrer becomes eligible to receive a reward. The configuration is described in this tutorial

Responding to a webhook

Voucherify expects your webhook to return a response with a 2XX HTTP status code, indicating that the webhook has been received successfully. If a webhook is not successfully received for any reason, Voucherify will continue trying to send the webhook once an hour for up to 3 days.

Authentication

Once your server is configured to receive payloads, it'll listen for any payload sent to the endpoint you configured. For security reasons, you probably want to limit requests to those coming from Voucherify. To do so, you should set up a secret token and validate the information.

You can generate a secret key in Project Settings:

You can find the token in X-Voucherify-Signature field.

Then, you can validate the signature in your application. To see an example, go to verifySignature method in the NodeJS SDK

const crypto = require('crypto') 

verifySignature: function (signature, message, secretKey) {
  return crypto.createHmac('sha256', secretKey)
    .update(isString(message) && message || JSON.stringify(message))
    .digest('hex') === signature
}

Webhooks


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.