All URIs are relative to https://api.voucherify.io
| Method | HTTP request | Description |
|---|---|---|
| CreateOrder | POST /v1/orders | Create Order |
| CreateOrderExport | POST /v1/orders/export | Create Orders Export |
| GetOrder | GET /v1/orders/{orderId} | Get Order |
| ImportOrders | POST /v1/orders/import | Import Orders |
| ListOrders | GET /v1/orders | List Orders |
| UpdateOrder | PUT /v1/orders/{orderId} | Update Order |
OrdersCreateResponseBody CreateOrder (OrdersCreateRequestBody ordersCreateRequestBody)
Create Order
Creates an order object and triggers an order creation event. 📘 Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields.
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class CreateOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var ordersCreateRequestBody = new OrdersCreateRequestBody(); // OrdersCreateRequestBody | Specify the order parameters.
try
{
// Create Order
OrdersCreateResponseBody result = apiInstance.CreateOrder(ordersCreateRequestBody);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.CreateOrder: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Create Order
ApiResponse<OrdersCreateResponseBody> response = apiInstance.CreateOrderWithHttpInfo(ordersCreateRequestBody);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.CreateOrderWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| ordersCreateRequestBody | OrdersCreateRequestBody | Specify the order parameters. |
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns an order object if the operation succeeded. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrdersExportCreateResponseBody CreateOrderExport (OrdersExportCreateRequestBody ordersExportCreateRequestBody)
Create Orders Export
Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields:
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class CreateOrderExportExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var ordersExportCreateRequestBody = new OrdersExportCreateRequestBody(); // OrdersExportCreateRequestBody | Specify which order parameters you would like to export.
try
{
// Create Orders Export
OrdersExportCreateResponseBody result = apiInstance.CreateOrderExport(ordersExportCreateRequestBody);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.CreateOrderExport: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Create Orders Export
ApiResponse<OrdersExportCreateResponseBody> response = apiInstance.CreateOrderExportWithHttpInfo(ordersExportCreateRequestBody);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.CreateOrderExportWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| ordersExportCreateRequestBody | OrdersExportCreateRequestBody | Specify which order parameters you would like to export. |
OrdersExportCreateResponseBody
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the Get Export method to generate the url for the downloadable CSV file or in the Download Export method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrdersGetResponseBody GetOrder (string orderId)
Get Order
Retrieve a specific order by passing its ID.
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class GetOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var orderId = "orderId_example"; // string | Unique Voucherify order ID or order source ID.
try
{
// Get Order
OrdersGetResponseBody result = apiInstance.GetOrder(orderId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.GetOrder: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get Order
ApiResponse<OrdersGetResponseBody> response = apiInstance.GetOrderWithHttpInfo(orderId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.GetOrderWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | Unique Voucherify order ID or order source ID. |
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns an order object if a valid identifier was provided. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrdersImportCreateResponseBody ImportOrders (List ordersImportCreateRequestBodyItem)
Import Orders
🚧 Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the update order endpoint should be used. This is critical because this endpoint does not store events or launch distributions. The orders will also have a created_at date thats assigned when theyve been imported to Voucherify. To keep track of the actual order creation date, add an order metadata in ISO 8601 date or date time format to each imported order. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit of orders per one request. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - Customers entering into segments - Distributions based on any rules tied to customer entering segment(s) - Earning rules based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / SKUs. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / SKUs. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / SKUs, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. 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 with GET Async Action endpoint.
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class ImportOrdersExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var ordersImportCreateRequestBodyItem = new List<OrdersImportCreateRequestBodyItem>(); // List<OrdersImportCreateRequestBodyItem> | The request body is sent in the form of an array of order objects.
try
{
// Import Orders
OrdersImportCreateResponseBody result = apiInstance.ImportOrders(ordersImportCreateRequestBodyItem);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.ImportOrders: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Import Orders
ApiResponse<OrdersImportCreateResponseBody> response = apiInstance.ImportOrdersWithHttpInfo(ordersImportCreateRequestBodyItem);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.ImportOrdersWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| ordersImportCreateRequestBodyItem | List<OrdersImportCreateRequestBodyItem> | The request body is sent in the form of an array of order objects. |
OrdersImportCreateResponseBody
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the order(s) will be added to the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using Get Async Action endpoint. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrdersListResponseBody ListOrders (int? limit = null, int? page = null, ParameterOrderListOrders? order = null)
List Orders
Returns a list of orders.
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class ListOrdersExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var limit = 56; // int? | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional)
var page = 56; // int? | Which page of results to return. The lowest value is 1. (optional)
var order = (ParameterOrderListOrders) "created_at"; // ParameterOrderListOrders? | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional)
try
{
// List Orders
OrdersListResponseBody result = apiInstance.ListOrders(limit, page, order);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.ListOrders: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// List Orders
ApiResponse<OrdersListResponseBody> response = apiInstance.ListOrdersWithHttpInfo(limit, page, order);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.ListOrdersWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| limit | int? | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] |
| page | int? | Which page of results to return. The lowest value is 1. | [optional] |
| order | ParameterOrderListOrders? | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] |
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns a dictionary with order objects. The orders are returned sorted by creation date by default, with the most recent orders appearing last, unless you specify another sequence using the order query parameter. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrdersUpdateResponseBody UpdateOrder (string orderId, OrdersUpdateRequestBody ordersUpdateRequestBody)
Update Order
Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.
using System.Collections.Generic;
using System.Diagnostics;
using Voucherify.Api;
using Voucherify.Client;
using Voucherify.Model;
namespace Example
{
public class UpdateOrderExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.voucherify.io";
// Configure API key authorization: X-App-Id
config.AddApiKey("X-App-Id", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Id", "Bearer");
// Configure API key authorization: X-App-Token
config.AddApiKey("X-App-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-App-Token", "Bearer");
// Configure OAuth2 access token for authorization: X-Voucherify-OAuth
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi(config);
var orderId = "orderId_example"; // string | Unique Voucherify order ID or order source ID.
var ordersUpdateRequestBody = new OrdersUpdateRequestBody(); // OrdersUpdateRequestBody | Specify the parameters of the order that are to be updated.
try
{
// Update Order
OrdersUpdateResponseBody result = apiInstance.UpdateOrder(orderId, ordersUpdateRequestBody);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.UpdateOrder: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Update Order
ApiResponse<OrdersUpdateResponseBody> response = apiInstance.UpdateOrderWithHttpInfo(orderId, ordersUpdateRequestBody);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OrdersApi.UpdateOrderWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | Unique Voucherify order ID or order source ID. | |
| ordersUpdateRequestBody | OrdersUpdateRequestBody | Specify the parameters of the order that are to be updated. |
X-App-Id, X-App-Token, X-Voucherify-OAuth
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Returns the order object if the update succeeded. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]