Integrating Voucherify into your app or website can begin as soon as you create a Voucherify account. Then, only 3 more steps are required to start integration:
- Get your API keys so Voucherify can authenticate your integration API requests.
- Install an SDKÂ so you can interact with the Voucherify API.
- Make a test API request to confirm everything is up and running.
In the following tutorial, we're going to redeem one of the pre-defined test voucher codes that come with the developer sandbox.
Get your API keys
Voucherify authenticates your requests with API keys you can find in your account. Every account comes with two pairs of keys with different access levels that serve different integration architectures (application and client-side).


On top of that, every request exists in either Production or Test (sandbox) mode. Objects in one mode cannot be manipulated by objects in the other.


Now, obtain your keys (Application Id and Application Secret Key) in the Project settings in your account.
The following code sample works with the Voucherify test account, you should replace the keys with the ones from the dashboard to see if examples are populated with your account.
Install SDK
We provide official libraries for different programming languages and mobile platforms.
Make a test API request
To check if your integration is working correctly, make a test redemption request using your sandbox keys.
Note
Every sandbox is populated with a set of test vouchers. Note that these codes aren't visible in the dashboard and that redemptions performed on them don't count towards your monthly limits.
Call the redemption endpoint passing a voucher you want to redeem.
curl -X POST \
-H "X-App-Id: 8a824b12-0530-4ef4-9479-d9e9b9930176" \
-H "X-App-Token: 9e322bac-8297-49f7-94c8-07946724bcbc" \
-H "Content-Type: application/json" \
-d '{}' "https://api.voucherify.io/v1/vouchers/voucherify.io-10-percent-off/redemption"
const voucherifyClient = require('voucherify')
const client = voucherifyClient({
applicationId: '8a824b12-0530-4ef4-9479-d9e9b9930176',
clientSecretKey: '9e322bac-8297-49f7-94c8-07946724bcbc'
})
client.redemptions.redeem("voucherify.io-10-percent-off").then(console.log)
require_once('vendor/autoload.php');
use Voucherify\VoucherifyClient;
use Voucherify\ClientException;
$apiID = "8a824b12-0530-4ef4-9479-d9e9b9930176";
$apiKey = "9e322bac-8297-49f7-94c8-07946724bcbc";
$client = new VoucherifyClient($apiID, $apiKey);
$print_r($client->redemptions->redeem("voucherify.io-10-percent-off"));
require 'voucherify'
voucherify = Voucherify::Client.new({
:applicationId => '8a824b12-0530-4ef4-9479-d9e9b9930176',
:clientSecretKey => '9e322bac-8297-49f7-94c8-07946724bcbc'
})
puts voucherify.redemptions.redeem('voucherify.io-10-percent-off')
import io.voucherify.client.VoucherifyClient;
import io.voucherify.client.model.redemption.RedeemVoucher;
import io.voucherify.client.model.redemption.response.RedeemVoucherResponse;
class QuickStartApp {
public static void main(String[] args) {
VoucherifyClient client = new VoucherifyClient.Builder()
.setAppId("8a824b12-0530-4ef4-9479-d9e9b9930176")
.setClientSecretKey("9e322bac-8297-49f7-94c8-07946724bcbc")
.build();
RedeemVoucher redeemVoucher = RedeemVoucher.builder().build();
RedeemVoucherResponse redeemVoucherResponse = client.redemptions().redeem("voucherify.io-10-percent-off", redeemVoucher);
System.out.println("Redemption: " + redeemVoucherResponse);
}
}
using System;
using Voucherify.DataModel;
using Voucherify.Core.Exceptions;
using System.Threading.Tasks;
public class Program {
public static void Main() {
var api = new Voucherify.Api(
"8a824b12-0530-4ef4-9479-d9e9b9930176",
"9e322bac-8297-49f7-94c8-07946724bcbc"
).WithSSL();
try
{
Voucherify.DataModel.Queries.RedemptionRedeem query = new Voucherify.DataModel.Queries.RedemptionRedeem();
Voucherify.DataModel.Contexts.RedemptionRedeem context = new Voucherify.DataModel.Contexts.RedemptionRedeem();
Voucherify.DataModel.Redemption redemption = await api.Redemptions.RedeemVoucher("voucherify.io-10-percent-off", query, context);
Console.WriteLine("Redemption: {0}", redemption);
}
catch(Voucherify.Core.Exceptions.VoucherifyClientException exception) {
Console.WriteLine("Exception: {0}", exception);
}
}
}
Voucherify will reply with redemption and voucher details.
{
"id":"r_c9PaWW40Nhq8s2f9YbYvWqaL",
"object":"redemption",
"date":"2018-07-17T13:08:30Z",
"customer_id":null,
"tracking_id":"(tracking_id not set)",
"result":"SUCCESS",
"voucher":{
"code":"voucherify.io-10-percent-off",
"campaign":null,
"category":"sandbox",
"type":"DISCOUNT_VOUCHER",
"discount":{
"type":"PERCENT",
"percent_off":10.0
},
"gift":null,
"start_date":null,
"expiration_date":null,
"validity_timeframe":null,
"publish":{
"object":"list",
"count":0,
"url":"/v1/vouchers/voucherify.io-10-percent-off/publications?page=1&limit=10"
},
"redemption":{
"object":"list",
"quantity":null,
"redeemed_quantity":1,
"url":"/v1/vouchers/voucherify.io-10-percent-off/redemptions?page=1&limit=10"
},
"active":true,
"additional_info":null,
"metadata":null,
"assets":{
"qr":{
"id":"U2FsdGVkX1+p1AE6wbSzAiurW+csDQS3y6NQJcAxxThFNw9z9yK7NY7TTA8bPmRvYFWJBMlxv6aX4QoCckkuK0srOF8RXPBe2NzNxJAkbdRxJxNon9y9PZeMLyHQ+jVhmnnwlEcrA3QJJHEk1WNa3fPuZxmDDdPcy1Nxh3HaHy5ZMPIdf+sD6HlqIpbijmF5",
"url":"[https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp1AE6wbSzAiurW%2BcsDQS3y6NQJcAxxThFNw9z9yK7NY7TTA8bPmRvYFWJBMlxv6aX4QoCckkuK0srOF8RXPBe2NzNxJAkbdRxJxNon9y9PZeMLyHQ%2BjVhmnnwlEcrA3QJJHEk1WNa3fPuZxmDDdPcy1Nxh3HaHy5ZMPIdf%2BsD6HlqIpbijmF5"
},
"barcode":{
"id":"U2FsdGVkX18vb3FOlGCLTUsqnSgaorD1tMjLewTDnjDFUbDH1gxlXykrlaJZulrLaUOOHaE+JY6ulQ4PwFkr7U7fQrdcVHpfgDa+Xzi3nbspZw+V56i4PpvJ1KSURUDGqc5Ykta5Ai4G45HV7xlrzxIbiX75Aq8BDjbXnHr488X7Veavcc+vkukKFE2CNrsS",
"url":"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vb3FOlGCLTUsqnSgaorD1tMjLewTDnjDFUbDH1gxlXykrlaJZulrLaUOOHaE%2BJY6ulQ4PwFkr7U7fQrdcVHpfgDa%2BXzi3nbspZw%2BV56i4PpvJ1KSURUDGqc5Ykta5Ai4G45HV7xlrzxIbiX75Aq8BDjbXnHr488X7Veavcc%2BvkukKFE2CNrsS"
}
},
"is_referral_code":false,
"updated_at":"2018-07-17T13:08:30Z",
"object":"voucher](https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp1AE6wbSzAiurW%2BcsDQS3y6NQJcAxxThFNw9z9yK7NY7TTA8bPmRvYFWJBMlxv6aX4QoCckkuK0srOF8RXPBe2NzNxJAkbdRxJxNon9y9PZeMLyHQ%2BjVhmnnwlEcrA3QJJHEk1WNa3fPuZxmDDdPcy1Nxh3HaHy5ZMPIdf%2BsD6HlqIpbijmF5%22%7D,%22barcode%22:%7B%22id%22:%22U2FsdGVkX18vb3FOlGCLTUsqnSgaorD1tMjLewTDnjDFUbDH1gxlXykrlaJZulrLaUOOHaE+JY6ulQ4PwFkr7U7fQrdcVHpfgDa+Xzi3nbspZw+V56i4PpvJ1KSURUDGqc5Ykta5Ai4G45HV7xlrzxIbiX75Aq8BDjbXnHr488X7Veavcc+vkukKFE2CNrsS%22,%22url%22:%22https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vb3FOlGCLTUsqnSgaorD1tMjLewTDnjDFUbDH1gxlXykrlaJZulrLaUOOHaE%2BJY6ulQ4PwFkr7U7fQrdcVHpfgDa%2BXzi3nbspZw%2BV56i4PpvJ1KSURUDGqc5Ykta5Ai4G45HV7xlrzxIbiX75Aq8BDjbXnHr488X7Veavcc%2BvkukKFE2CNrsS%22%7D%7D,%22is_referral_code%22:false,%22updated_at%22:%222018-07-17T13:08:30Z%22,%22object%22:%22voucher)"
}
}
Updated 4 months ago