All URIs are relative to https://api.voucherify.io
Method | HTTP request | Description |
---|---|---|
checkEligibilityClientSide | POST /client/v1/qualifications | Check Eligibility (client-side) |
redeemStackedDiscountsClientSide | POST /client/v1/redemptions | Redeem Stackable Discounts (client-side) |
trackCustomEventClientSide | POST /client/v1/events | Track Custom Event (client-side) |
updateCustomersConsentsClientSide | PUT /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) |
validateStackedDiscountsClientSide | POST /client/v1/validations | Validate Stackable Discounts (client-side) |
ClientQualificationsCheckEligibilityResponseBody checkEligibilityClientSide(clientQualificationsCheckEligibilityRequestBody)
Check Eligibility (client-side)
Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version > 👍 Scenario Guide > > Read our dedicated guide to learn about some use cases this endpoint can cover here. ## Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the `starting_after` cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the `starting_after` parameter. - The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available. - Get the value of the `created_at` parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the `starting_after` parameter set to the value taken from the `created_at` parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.
// Import classes:
import voucherify.client.ApiClient;
import voucherify.client.ApiException;
import voucherify.client.Configuration;
import voucherify.client.auth.*;
import voucherify.client.models.*;
import voucherify.client.api.ClientSideApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.voucherify.io");
// Configure API key authorization: X-Client-Application-Id
ApiKeyAuth X-Client-Application-Id = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Application-Id");
X-Client-Application-Id.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Application-Id.setApiKeyPrefix("Token");
// Configure API key authorization: X-Client-Token
ApiKeyAuth X-Client-Token = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Token");
X-Client-Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Token.setApiKeyPrefix("Token");
ClientSideApi apiInstance = new ClientSideApi(defaultClient);
ClientQualificationsCheckEligibilityRequestBody clientQualificationsCheckEligibilityRequestBody = new ClientQualificationsCheckEligibilityRequestBody(); // ClientQualificationsCheckEligibilityRequestBody | Define order and customer context.
try {
ClientQualificationsCheckEligibilityResponseBody result = apiInstance.checkEligibilityClientSide(clientQualificationsCheckEligibilityRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClientSideApi#checkEligibilityClientSide");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
clientQualificationsCheckEligibilityRequestBody | ClientQualificationsCheckEligibilityRequestBody | Define order and customer context. | [optional] |
ClientQualificationsCheckEligibilityResponseBody
X-Client-Application-Id, X-Client-Token
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Returns a qualifications object. | - |
ClientRedemptionsRedeemResponseBody redeemStackedDiscountsClientSide(origin, clientRedemptionsRedeemRequestBody)
Redeem Stackable Discounts (client-side)
This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. ## How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: | Field | Calculation | Description | |:---|:---|:---| | amount | N/A | This field shows the order amount before applying any discount | | total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts | | discount_amount | `discount_amount` = `previous_discount_amount` + `applied_discount_amount` | This field sums up all order-level discounts up to and including the specific discount being calculated for the stacked redemption. | | items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts | | total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts | | applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request | | items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request | | total_applied_discount_amount | `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | This field sums up all order-level and all product-specific discounts applied in a particular request | <!-- theme: info --> > 📘 Rollbacks > > You can't roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your <!-- rollback request -->rollback request.
// Import classes:
import voucherify.client.ApiClient;
import voucherify.client.ApiException;
import voucherify.client.Configuration;
import voucherify.client.auth.*;
import voucherify.client.models.*;
import voucherify.client.api.ClientSideApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.voucherify.io");
// Configure API key authorization: X-Client-Application-Id
ApiKeyAuth X-Client-Application-Id = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Application-Id");
X-Client-Application-Id.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Application-Id.setApiKeyPrefix("Token");
// Configure API key authorization: X-Client-Token
ApiKeyAuth X-Client-Token = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Token");
X-Client-Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Token.setApiKeyPrefix("Token");
ClientSideApi apiInstance = new ClientSideApi(defaultClient);
String origin = "origin_example"; // String | Indicates the origin (scheme, hostname, and port).
ClientRedemptionsRedeemRequestBody clientRedemptionsRedeemRequestBody = new ClientRedemptionsRedeemRequestBody(); // ClientRedemptionsRedeemRequestBody |
try {
ClientRedemptionsRedeemResponseBody result = apiInstance.redeemStackedDiscountsClientSide(origin, clientRedemptionsRedeemRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClientSideApi#redeemStackedDiscountsClientSide");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
origin | String | Indicates the origin (scheme, hostname, and port). | |
clientRedemptionsRedeemRequestBody | ClientRedemptionsRedeemRequestBody | [optional] |
ClientRedemptionsRedeemResponseBody
X-Client-Application-Id, X-Client-Token
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid redemption. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - |
ClientEventsCreateResponseBody trackCustomEventClientSide(origin, clientEventsCreateRequestBody)
Track Custom Event (client-side)
To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesn't exist in Voucherify, the customer will be created.
// Import classes:
import voucherify.client.ApiClient;
import voucherify.client.ApiException;
import voucherify.client.Configuration;
import voucherify.client.auth.*;
import voucherify.client.models.*;
import voucherify.client.api.ClientSideApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.voucherify.io");
// Configure API key authorization: X-Client-Application-Id
ApiKeyAuth X-Client-Application-Id = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Application-Id");
X-Client-Application-Id.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Application-Id.setApiKeyPrefix("Token");
// Configure API key authorization: X-Client-Token
ApiKeyAuth X-Client-Token = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Token");
X-Client-Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Token.setApiKeyPrefix("Token");
ClientSideApi apiInstance = new ClientSideApi(defaultClient);
String origin = "origin_example"; // String | Indicates the origin (scheme, hostname, and port).
ClientEventsCreateRequestBody clientEventsCreateRequestBody = new ClientEventsCreateRequestBody(); // ClientEventsCreateRequestBody | Specify the details of the custom event.
try {
ClientEventsCreateResponseBody result = apiInstance.trackCustomEventClientSide(origin, clientEventsCreateRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClientSideApi#trackCustomEventClientSide");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
origin | String | Indicates the origin (scheme, hostname, and port). | |
clientEventsCreateRequestBody | ClientEventsCreateRequestBody | Specify the details of the custom event. | [optional] |
ClientEventsCreateResponseBody
X-Client-Application-Id, X-Client-Token
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Returns the event type if the event was received by the application. | - |
updateCustomersConsentsClientSide(customerId, body)
Update Customer's consents (client-side)
Update marketing permissions for the specified customer.
// Import classes:
import voucherify.client.ApiClient;
import voucherify.client.ApiException;
import voucherify.client.Configuration;
import voucherify.client.auth.*;
import voucherify.client.models.*;
import voucherify.client.api.ClientSideApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.voucherify.io");
// Configure API key authorization: X-Client-Application-Id
ApiKeyAuth X-Client-Application-Id = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Application-Id");
X-Client-Application-Id.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Application-Id.setApiKeyPrefix("Token");
// Configure API key authorization: X-Client-Token
ApiKeyAuth X-Client-Token = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Token");
X-Client-Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Token.setApiKeyPrefix("Token");
ClientSideApi apiInstance = new ClientSideApi(defaultClient);
String customerId = "customerId_example"; // String | A Voucherify customer identifier or `source_id`
Object body = {"cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I":true,"cnst_VCmucIvAsmDYw2PPAok6bcYy":false}; // Object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ```
try {
apiInstance.updateCustomersConsentsClientSide(customerId, body);
} catch (ApiException e) {
System.err.println("Exception when calling ClientSideApi#updateCustomersConsentsClientSide");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
customerId | String | A Voucherify customer identifier or `source_id` | |
body | Object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use "unsubscribed" as a consent identifier and "true" as its value. #### Examples <!-- title: "Request Body" lineNumbers: true --> ```json { "cnst_aIdUulAh0SCsOCaS3005y7yS": true, "cnst_aIdUulAhwewqaS31213fdsfds": false } ``` Opt-out from all communication: <!-- title: "Request Body" lineNumbers: true --> ```json { "unsubscribed": true } ``` | [optional] |
null (empty response body)
X-Client-Application-Id, X-Client-Token
- Content-Type: application/json
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | Returns no content if the consents were updated successfully. | - |
ClientValidationsValidateResponseBody validateStackedDiscountsClientSide(origin, clientValidationsValidateRequestBody)
Validate Stackable Discounts (client-side)
Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.
// Import classes:
import voucherify.client.ApiClient;
import voucherify.client.ApiException;
import voucherify.client.Configuration;
import voucherify.client.auth.*;
import voucherify.client.models.*;
import voucherify.client.api.ClientSideApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.voucherify.io");
// Configure API key authorization: X-Client-Application-Id
ApiKeyAuth X-Client-Application-Id = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Application-Id");
X-Client-Application-Id.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Application-Id.setApiKeyPrefix("Token");
// Configure API key authorization: X-Client-Token
ApiKeyAuth X-Client-Token = (ApiKeyAuth) defaultClient.getAuthentication("X-Client-Token");
X-Client-Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Client-Token.setApiKeyPrefix("Token");
ClientSideApi apiInstance = new ClientSideApi(defaultClient);
String origin = "origin_example"; // String | Indicates the origin (scheme, hostname, and port).
ClientValidationsValidateRequestBody clientValidationsValidateRequestBody = new ClientValidationsValidateRequestBody(); // ClientValidationsValidateRequestBody |
try {
ClientValidationsValidateResponseBody result = apiInstance.validateStackedDiscountsClientSide(origin, clientValidationsValidateRequestBody);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClientSideApi#validateStackedDiscountsClientSide");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
origin | String | Indicates the origin (scheme, hostname, and port). | |
clientValidationsValidateRequestBody | ClientValidationsValidateRequestBody | [optional] |
ClientValidationsValidateResponseBody
X-Client-Application-Id, X-Client-Token
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid validation. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - |