The redemption object

Data model description

Redemption is the key operation in the voucher and promotion tier lifecycle. A customer can redeem a voucher or promotion tier once or multiple times depending on selected limit (quantity). Each redemption is recorded in voucher/promotion's history (redemption_entries). There is also an option to cancel a redemption. We call such operation a redemption rollback.

Attributes

Description

Example

id
string

r_iMsIlXpjfQwMWFJPEPJFeJ4h

object
string

Type of the object represented by JSON. Value is redemption.

date
string, ISO 8601 date format

2016-11-16T14:14:31Z

customer_id
string

An identifier of a customer stored in Voucherify that redeemed a voucher.

cust_PqojQVpYAmwtcddM3oGfRh05

tracking_id
string

A tracking identifier of a user that redeemed a voucher. Identifier generated during voucher validation.

track_122jQVpYAmwtcddM3oHhHh05

gift.amount
integer

A positive integer representing total value redeemed for gift voucher. It is not presented for discount vouchers. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 discount is written as 10000.

"gift": {
    "amount": 10000
}

order
object

The purchase of previously defined products by end customers is handled through the creation of order objects. Order object is used to evaluate redemption rules based on products and total order volume.

Child attributes:

  • amount (integer) - A positive integer representing total order value. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 discount is written as 10000.

  • *total_discount_amount (integer) - A positive integer representing total discount value. Value is multiplied by 100 to precisely represent 2 decimal places (for example, $100 is 10000).

  • total_amount - (integer) A positive integer representing total order value after applying the discount. Value is multiplied by 100 to precisely represent 2 decimal places (for example, $100 is 10000).

  • items (list) - A list of Order Items that have been applied to the order (for example, $100 is 10000).

"order": {
    "amount": 10000,
    "items": [
      {
        "product_id": "prod_Bi7sRr3kwvxH2I",
        "sku_id": null,
        "quantity": 1
      }
    ]
  }

metadata
object

A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.

"metadata": {
    "test": true,
    "locale": "pl-en"
}

voucher
object

Object presenting redeemed voucher.

"voucher": {
    "code": "Testing7fjWdr",
    "campaign": null,
    "category": "test",
    "type": "DISCOUNT_VOUCHER",
    "discount": {
      "type": "AMOUNT",
      "amount_off": 1000
    },
    "gift": null,
    "start_date": null,
    "expiration_date": null,
    "publish": {},
    "redemption": {},
    "active": true,
    "additional_info": null,
    "metadata": {},
    "assets": null
}

customer
object

Object of the customer this redemption is for if one exists.

"customer": {
    "object": "customer",
    "id": "cust_PqojQVpYAmwtcddM3oGfRh05",
    "source_id": "[email protected]",
    "name": "Joe Doa"
}

result
string

The status of the redemption is either SUCCESS or FAILURE.

failure_code
string

Error code explaining reason for redemption failure if available (see the errors section for a list of keys).

{
  "id": "r_iMsIlXpjfQwMWFJPEPJFeJ4h",
  "object": "redemption",
  "date": "2016-11-16T14:14:31Z",
  "customer_id": "cust_PqojQVpYAmwtcddM3oGfRh05",
  "tracking_id": "[email protected]",
  "order": {
    "amount": 10000,
    "items": [
      {
        "product_id": "prod_EkU6J42uLEMkSJ",
        "sku_id": null,
        "quantity": 1
      }
    ]
  },
  "metadata": {
    "test": true,
    "locale": "pl-en"
  },
  "result": "SUCCESS",
  "voucher": {
    "code": "Testing7fjWdr",
    "campaign": null,
    "category": "test",
    "type": "DISCOUNT_VOUCHER",
    "discount": {
      "type": "AMOUNT",
      "amount_off": 1000
    },
    "gift": null,
    "start_date": null,
    "expiration_date": null,
    "publish": {
      "count": 0,
      "entries": []
    },
    "redemption": {
      "quantity": null,
      "redeemed_quantity": 1,
      "redeemed_amount": 10000,
      "redemption_entries": []
    },
    "active": true,
    "additional_info": null,
    "metadata": {
      "test": true,
      "locale": "pl-en"
    },
    "assets": {
      "qr": {
        "id": "U2FsdGVkX19kSEL6ZbJWNQP/0Nt5ddIJDdvJDgHoeWo25FAq1aAn1L3kd6S/sSHUHYwHXaFtsnJ1Lesh0yzGA7aMNf6kgMUD/dDw1e77kedfhV3BpBWEgYWY1GurPbzV50rexNBppZjPTVJN5DQXJQ==",
        "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19kSEL6ZbJWNQP%2F0Nt5ddIJDdvJDgHoeWo25FAq1aAn1L3kd6S%2FsSHUHYwHXaFtsnJ1Lesh0yzGA7aMNf6kgMUD%2FdDw1e77kedfhV3BpBWEgYWY1GurPbzV50rexNBppZjPTVJN5DQXJQ%3D%3D"
      }
    }
  }
}