Use the Origin Voucher API to create vouchers for redeeming digital content (like eBooks or audiobooks). This guide walks you through the full process — from setup to handling API responses and errors.
API Documentation can be found on our developer portal.
You can optionally use the Snapplify Ecommerce plugin to manage vouchers with Wordpress.
Prerequisites
Before you start:
- Get your API key from Snapplify
- Format: JSON
- Method: POST
API Endpoint
Key | Value |
Endpoint | https://api.snapplify.com/vouchers |
Method | Post |
Format | application/json |
Define Voucher Parameters
Use the following parameters to define your voucher in the request body:
Parameter | Required | Description |
label | Yes | The name of the voucher (used for internal reference) |
code | No | Provide a custom voucher code. If omitted, one will be generated. |
reference | Yes | Your internal reference for tracking |
quantity | Yes | Number of times a voucher can be redeemed |
sessions | No | Restrict redemptions to a specific number of sessions |
recipientEmail | No | An optional email address. If supplied, this email address will receive the newly created voucher via email. |
autoRedeem | No | If True, the voucher will Auto-redeem for the user |
Field Rules and Defaults
How voucher fields behave depends on how the voucher is created:
- Both voucher.reference and voucher.label are optional.
- If voucher.label is not provided, it defaults to the value of voucher.reference.
- If voucher.reference is not provided, it defaults to the value of voucher.code.
- If voucher.code is not specified, a code is generated automatically.
Example Request
{ "label": "SNAPVOUCHER", "reference": "ORDER123", "quantity": 1, "email": "user@example.com" }
API Response
A successful request returns:
{ "label": "Snapplify Voucher", "code": "SNAPVOUCHER123", "reference": "Snapplify Voucher", "quantity": 1, "quantityRemaining": 1, "email": "user@example.com", "sessions": 1, "autoRedeem": false, "createdAt": "2023-09-02T07:21:14+00:00" }
Handling Errors
Code | Message | Description |
400 | Validation error | Likely, a required field is missing |
401 | Unauthorized | Check your API key |
409 | Conflict | Voucher code already exists |
500 | Server Error | Internal issue, try again later |
Advanced Use Cases and Notes
Redeem limits and multiple use
You can control how many times a voucher can be used (quantity) and whether it can be used by multiple users or just one (sessions).
Example – Single user, multiple redemptions
{ "label": "Single User Multi-Redeem", "reference": "STUDENT456", "quantity": 3, "sessions": 1 }
JSON Error Example
{ "status": 400, "message": "Could not create voucher: {Your Custom Error}" }
Once your voucher is created, test it in your application or platform to confirm it works as expected. If needed, use the API responses and error messages to troubleshoot.
To learn more about using vouchers or managing redemptions, explore the related articles below.
Need help? Use the live chat in the bottom right corner of your screen, email us at help@snapplify.com or reach out via Whatsapp +27 60 011 8065.