These docs are for v1.0. Click to read the latest docs for v2.1.

Redeem a voucher

Redeeming a voucher is very simple. Just pass the voucher code, a unique transaction_id that identifies the transaction in your system and the total transaction cost. Vouchery will validate the code and all the limitations and return with an detailed information if redemption was successful.

In this example we will focus on successful redemption. For information on handling errors please refer to API Reference.

Single step redemption is suitable for systems where discount verification is not integrated directly into the checkout, like not internet-enabled POS systems or even cash payments. We strongly encourage our customers to use two-step redemption process, which is covered next.

curl --request POST \
     --user "username:password" \
     --url "https://preview.vouchery.io/api/v1.0/vouchers/VOU-S4H9LX/redemptions" \
     --header "Content-Type: application/json" \
     --data \
'
{
  "transaction_id": "TRAN-01b7df8b-ae82-4ad2-899e-feddf538eb7e",
  "total_transaction_cost": 100.00,
  "confirmed": true
}
'
{
  "type": "Redemption",
  "id": 4,
  "total_transaction_cost": 100.00,
  "granted_discount": 5.00,
  "transaction_id": "TRAN-01b7df8b-ae82-4ad2-899e-feddf538eb7e",
  "validated_at": "2018-10-14T20:32:58.339Z",
  "confirmed_at": "2018-10-14T20:32:58.339Z",
  "voucher": {
    "type": "Voucher",
    "id": 199,
    "campaign_id": 9,
    "code": "VOU-S4H9LX",
    "campaign": {
      "type": "Campaign",
      "id": 9,
      "name": "Fall Haul"
    }
  }
}