All URIs are relative to https://api.voucherify.io
Method | HTTP request | Description |
---|---|---|
delete_voucher | DELETE /v1/vouchers/{code} | Delete Voucher |
disable_voucher | POST /v1/vouchers/{code}/disable | Disable Voucher |
enable_voucher | POST /v1/vouchers/{code}/enable | Enable Voucher |
export_voucher_transactions | POST /v1/vouchers/{code}/transactions/export | Export Voucher Transactions |
get_voucher | GET /v1/vouchers/{code} | Get Voucher |
import_vouchers_using_csv | POST /v1/vouchers/importCSV | Import Vouchers using CSV |
list_voucher_transactions | GET /v1/vouchers/{code}/transactions | List Voucher Transactions |
release_validation_session | DELETE /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session |
update_voucher_balance | POST /v1/vouchers/{code}/balance | Add or Remove Voucher Balance |
delete_voucher(code, opts)
Delete Voucher
Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A unique **code** that identifies the voucher.
opts = {
force: true # Boolean | If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code.
}
begin
# Delete Voucher
api_instance.delete_voucher(code, opts)
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->delete_voucher: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A unique code that identifies the voucher. | |
force | Boolean | If this flag is set to true, the voucher will be removed permanently. Going forward, the user will be able to create another voucher with exactly the same code. | [optional] |
nil (empty response body)
- Content-Type: Not defined
- Accept: Not defined
disable_voucher(code)
Disable Voucher
There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - enable and disable. ___ This method sets the voucher state to inactive. The voucher cannot be redeemed.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.
begin
# Disable Voucher
result = api_instance.disable_voucher(code)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->disable_voucher: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. |
- Content-Type: Not defined
- Accept: application/json
enable_voucher(code)
Enable Voucher
There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - enable and disable. ___ The method sets the voucher state to active. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.
begin
# Enable Voucher
result = api_instance.enable_voucher(code)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->enable_voucher: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. |
- Content-Type: Not defined
- Accept: application/json
export_voucher_transactions(code, opts)
Export Voucher Transactions
Export transactions that are associated with credit movements on a gift card or loyalty card.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'GIFT-CARD-1' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.
opts = {
vouchers_transactions_export_create_request_body: VoucherifySdk::VouchersTransactionsExportCreateRequestBody.new # VouchersTransactionsExportCreateRequestBody | Specify the parameters for the transaction export.
}
begin
# Export Voucher Transactions
result = api_instance.export_voucher_transactions(code, opts)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->export_voucher_transactions: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | |
vouchers_transactions_export_create_request_body | VouchersTransactionsExportCreateRequestBody | Specify the parameters for the transaction export. | [optional] |
VouchersTransactionsExportCreateResponseBody
- Content-Type: application/json
- Accept: application/json
get_voucher(code)
Get Voucher
Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A unique **code** that identifies the voucher.
begin
# Get Voucher
result = api_instance.get_voucher(code)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->get_voucher: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A unique code that identifies the voucher. |
- Content-Type: Not defined
- Accept: application/json
import_vouchers_using_csv(file)
Import Vouchers using CSV
Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file here. ___ 📘 Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - Start and expiration dates need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code metadata. - You cannot import the same codes to a single Voucherify Project. 📘 Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
file = File.new('/path/to/some/file') # File | File path.
begin
# Import Vouchers using CSV
result = api_instance.import_vouchers_using_csv(file)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->import_vouchers_using_csv: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
file | File | File path. |
VouchersImportCsvCreateResponseBody
- Content-Type: multipart/form-data
- Accept: application/json
list_voucher_transactions(code, opts)
List Voucher Transactions
List transactions that are associated with credit movements on a gift card or loyalty card.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.
opts = {
limit: 56, # Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items.
page: 56 # Integer | Which page of results to return.
}
begin
# List Voucher Transactions
result = api_instance.list_voucher_transactions(code, opts)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->list_voucher_transactions: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | |
limit | Integer | A limit on the number of objects to be returned. Limit can range between 1 and 100 items. | [optional] |
page | Integer | Which page of results to return. | [optional] |
VouchersTransactionsListResponseBody
- Content-Type: Not defined
- Accept: application/json
release_validation_session(code, session_key)
Release Validation Session
Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. 📘 Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. Read more.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.
session_key = 'ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts' # String | A unique session identifier.
begin
# Release Validation Session
api_instance.release_validation_session(code, session_key)
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->release_validation_session: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify. | |
session_key | String | A unique session identifier. |
nil (empty response body)
- Content-Type: Not defined
- Accept: Not defined
update_voucher_balance(code, vouchers_balance_update_request_body)
Add or Remove Voucher Balance
Add balance to an existing gift card or loyalty card.
require 'time'
require 'VoucherifySdk'
# setup authorization
VoucherifySdk.configure do |config|
# Configure API key authorization: X-App-Id
config.api_key['X-App-Id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Id'] = 'Bearer'
# Configure API key authorization: X-App-Token
config.api_key['X-App-Token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['X-App-Token'] = 'Bearer'
end
api_instance = VoucherifySdk::VouchersApi.new
code = 'code_example' # String | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.
vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new({amount: 37}) # VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher.
begin
# Add or Remove Voucher Balance
result = api_instance.update_voucher_balance(code, vouchers_balance_update_request_body)
p result
rescue VoucherifySdk::ApiError => e
puts "Error when calling VouchersApi->update_voucher_balance: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
code | String | A code that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | |
vouchers_balance_update_request_body | VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher. |
VouchersBalanceUpdateResponseBody
- Content-Type: application/json
- Accept: application/json