โ๏ธ Deprecated
This endpoint represents the deprecated version of the API responsible for voucher redemption, and we do not recommend using it. The new Stackable Discounts API introduces additional features and improvements while maintaining backward compatibility, including applying a combination of coupon codes and promotion tiers. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint.
To redeem a voucher, you need to create a redemption object. It increments the redemption counter and updates the history of the voucher. This method is accessible through public keys, which you can use in client-side apps (mobile and web browser apps).
The client-side redemption works similar to the server-side voucher redemption endpoint. The difference lies in the authorization. For the client-side, you can use client-side keys.
๐ Opt-in
By default this feature is disabled. If you want to use it, you will need to enable the function explicitly in Project Settings.
โ๏ธ Security Threat
Be careful if you want to include the voucher redemption functionality directly on your client side (website or mobile app). In this configuration, there is a chance that discounts can be modified before being sent to the server.
You may expand the response by adding the following object to your request body. The expanded response will include the category details of the voucher.
{
"options": {
"expand": [
"category"
]
}
}
The access token received from the authorization server in the OAuth 2.0 flow.
Indicates the origin (scheme, hostname, and port).
Voucher code being redeemed.
"2CpRCE2c"
A tracking identifier of a user that redeemed a voucher. Identifier generated during voucher validation based on your internal id (e.g., email, database ID). This is a hashed customer source ID. If you also pass a customer ID, the tracking ID must be the ID of a source of the customer object. Otherwise, if you do not pass a customer ID, the tracking you provide must either be a token, like the ones returned by voucher validation, or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud.
Provide the redemption context in the request body.
Request body schema for redeeming a voucher using POST v1/vouchers/{code}/redemption.
Schema model for session lock object. The session object is required to establish a session between multiple parallel validation and redemption requests. If you only send the type parameter in the request, then by default the session lock will be established for 7 days. Read more on establishing a validation session.
Customer's information.
Order information.
A set of key/value pairs that you can send in the request body to check against vouchers requiring redemption metadata validation rules to be satisfied. The validation runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the Advanced Rule Builder โ Advanced โ Redemption metadata satisfy or Basic Builder โ Attributes match โ REDEMPTION METADATA. Read more.
Configure parameters returned in the response.
Returns a redemption object if the redeem operation succeeded.
Response body schema for POST v1/vouchers/{code}/redemption.
Unique redemption ID.
"r_0bc92f81a6801f9bca"
The type of the object represented by the JSON. This object stores information about the redemption.
Timestamp in ISO 8601 format indicating when the redemption occured.
"2022-10-03T12:24:58.008Z"
Unique customer ID of the redeeming customer.
"cust_i8t5Tt6eiKG5K79KQlJ0Vs64"
Hashed customer source ID.
"track_fxEMFiLowFHg=="
The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.
Redemption result.
SUCCESS, FAILURE Defines the details of the order that is related to the redemption.
Defines the details of the channel through which the redemption was issued.
Defines the customer that is related to the redemption.
Defines the related object.
| Related Object | Definition |
|---|---|
| voucher | Either a discount voucher, gift card, or loyalty card. |
voucher Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.
Defines the details of the voucher being redeemed.